Subsetting a data frame to the rows not appearing in another data frame

后端 未结 5 896
温柔的废话
温柔的废话 2021-01-23 13:53

I have a data frame A with observations

    Var1   Var2  Var3
     1       3    4
     2       5    6
     4       5    7
     4       5    8
     6       7    9         


        
5条回答
  •  佛祖请我去吃肉
    2021-01-23 14:26

    dplyr has a nice anti_join function that does exactly that:

    > library(dplyr)
    > anti_join(A, B)
    Joining by: c("Var1", "Var2", "Var3")
      Var1 Var2 Var3
    1    6    7    9
    2    4    5    8
    3    4    5    7
    

提交回复
热议问题