What does %>% mean in R
本问题已经有最佳答案,请猛点这里访问。
我正在关注此示例,server.R文件在此处。
我打算做一个类似的过滤器,但是对
1 2 3 4 5 6 7 8 9 10 11 | # Apply filters m <- all_movies %>% filter( Reviews >= reviews, Oscars >= oscars, Year >= minyear, Year <= maxyear, BoxOffice >= minboxoffice, BoxOffice <= maxboxoffice ) %>% arrange(Oscars) |
前缀运算符
它像管道一样工作,因此引用了马格利特的著名画作《图像的叛逆》。
该函数的作用是将运算符的左侧传递给运算符右侧的第一个参数。 在以下示例中,数据帧
1 2 3 4 5 6 7 8 9 | library(magrittr) iris %>% head() Sepal.Length Sepal.Width Petal.Length Petal.Width Species 1 5.1 3.5 1.4 0.2 setosa 2 4.9 3.0 1.4 0.2 setosa 3 4.7 3.2 1.3 0.2 setosa 4 4.6 3.1 1.5 0.2 setosa 5 5.0 3.6 1.4 0.2 setosa 6 5.4 3.9 1.7 0.4 setosa |
因此,
通常,多次调用
1 | iris %>% head() %>% summary() |
因此