是否可以过滤其他3列中存在的一列的值?
一个长远的解决方案是做到这一点
filter(Names1 %in% Names2| Names1 %in% Names3| Names1 %in% Names4)
是否有使用dplyr的更快方法?
类似的东西
filter(Names1 %in% (Names2| Names3 | Names4)
谢谢
我。
答案 0 :(得分:2)
您可以使用c()
组合正在查找的列:
df %>%
filter(Names1 %in% c(Names2, Names3, Names4))
答案 1 :(得分:0)
在base R
中,我们可以使用subset
subset(df, Names1 %in% c(Names2, Names3, Names4))