如何从数据框中排除与另一个数据框同一列中的行匹配的行?

How to exclude rows from dataframe that match rows in same column of another dataframe?

所以我想过滤掉第二个数据集中也存在的第一个数据框中的某些行。下面的命令没有生成我想要的数据框。

newdf <- filter(df1, df1$organization_name != df2$organization_name)

是否有可行的替代方案?

试试这个:

newdf <- filter(df1, !df1$organization_name %in% df2$organization_name)

###or using the pipe command:

newdf <- df1 %>%
filter(!df1$organization_name %in% df2$organization_name)

有些人更喜欢“反加入”功能,上面的建议更简单,可以解决问题