官方:
R now provides a simple native forward pipe syntax
|>
. The simple form of the forward pipe inserts the left-hand side as the first argument in the right-hand side call. The pipe implementation as a syntax transformation was motivated by suggestions from Jim Hester and Lionel Henry.
R 4.1.0 introduces a pipe operator
|>
into the base R syntax# R 4.1.0 rnorm(100, mean = 4, sd = 1) |> density() |> plot()
The new operator is nicer to type, and should be both more efficient and easier to debug, than the {magrittr} pipe.