Finding elements that do not overlap between two vectors

前端 未结 4 1759
一向
一向 2020-12-30 01:27

I\'m trying to identify elements which are not included in the other vector. For instance in two vectors I have

list.a <- c(\"James\", \"Mary\", \"Jack\",         


        
4条回答
  •  清酒与你
    2020-12-30 01:52

    A nice one-liner that applies to duplicates:

    anti_join(data_frame(c(1,1,2,2)), data_frame(c(1,1)))
    

    This returns the data frame {2,2}. This however doesn't apply to the case of 1,2 in 1,1,2,2, because it finds it twice

提交回复
热议问题