R: remove rows from one data frame that are in another

前端 未结 3 948
情书的邮戳
情书的邮戳 2021-02-08 21:32

I have two data frames df1 and df2. They have the same (two) columns. I want to remove the rows from df1 that are in df2.

3条回答
  •  长发绾君心
    2021-02-08 21:56

    I got an easy one considering you have a variable (var_match) that matches between the two dataframes:

    df_1_minus_2 <- df_1[which(!df_1$var_match %in% df_2$var_match),]
    

提交回复
热议问题