Find complement of a data frame (anti - join)

前端 未结 7 1031
情深已故
情深已故 2020-11-21 11:20

I have two data frames(df and df1). df1 is subset of df. I want to get a data frame which is complement of df1 in df, i.e. return rows of the first data set which are not ma

7条回答
  •  被撕碎了的回忆
    2020-11-21 12:06

    dplyr also has setdiff() which will get you the

    setdiff(bigFrame, smallFrame) gets you the extra records in the first table.

    so for the OP's example the code would read setdiff(df, df1)

    dplyr has a lot of great functionality: for a quick easy guide see here.

提交回复
热议问题