我想使用filter()
函数查找x值小于或等于4或y值大于5的类型。我认为这可能是一个简单的解决方法,我只是在?filter()
上找不到很多信息。我想差不多了:
x = c(1, 2, 3, 4, 5, 6)
y = c(3, 6, 1, 9, 1, 1)
type = c("cars", "bikes", "trains")
df = data.frame(x, y, type)
df2 = df %>%
filter(x<=4)
最佳答案
尝试
df %>%
filter(x <=4| y>=5)
关于r - filter()中的OR运算符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36134694/