Find elements not in smaller character vector list but in big list

前端 未结 3 1364
不知归路
不知归路 2020-12-09 21:21

I have the two big and small list. I want to know which of the elements in big list are not in smaller list. The list consists of property

([1] \"character\"         


        
3条回答
  •  情歌与酒
    2020-12-09 21:58

    While I think sets may help you to deal with different lists.

    In your case, you can just use:

    A <- c("A", "B", "C", "D")
    B <- c("A", "B", "C")
    
    # to find difference
    setdiff(A, B)
    
    # to find intersect
    intersect(A, B)
    
    # to find union
    union(A, B)
    

提交回复
热议问题