|
想达到类似SQL语句中的 效果。select * from table where 列名 in ('a','b','c','d')
从数据框中过滤 某列 包含多个关键字。
我能想到的方法比较笨 只会写个循环。。。如下:
ab<-data.frame(a=c(5.4,6.4,6.4,7.5,7.6,8.1,11.6,12.0,13.4,13.5,14.8,15.6,18.7))
for(i in c(12.0,7.6,8.1,18.7))
{
print(ab[which(ab$a==i ), ])
}
有这样的函数吗?谢谢各位啦。
|
|