R自带管道符
# compare with dplyr
library(dplyr)
iris %>%
mutate(p_ratio = Petal.Length / Petal.Width) %>%
filter(Sepal.Width > 3.5) %>%
select(Sepal.Length, p_ratio, Sepal.Width) %>%
slice_head(n = 10)
iris |>
transform(p_ratio = Petal.Length / Petal.Width) |>
subset(Sepal.Width > 3.5) |>
subset(, c(Sepal.Length, p_ratio, Sepal.Width)) |>
head(10)

浙公网安备 33010602011771号