The latest release of R introduces an F#-style pipe operator.
Pipes have been available in R for a while, via the magrittr package. However, with the release of R 4.1.0, pipes are supported in base R.
The syntax has changed from that used in magrittr. The magrittr pipe operator is %>%
. The new base R pipe operator is |>
.
So, instead of
df %>% head()
we have
df |> head()
R 4.1.0 also introduces a lightweight, lambda-style function syntax, which can be usefully combined with the new pipe operator when piping to an argument other than the first one.
iris |> {\(x) lm(Sepal.Width ~ Sepal.Length, data = x)}()