Files
developer-roadmap/roadmaps/r/content/pipe@0K17RO_EoOaT820WypQ7H.md

884 B

Pipe

The pipe operator takes the result on its left and passes it as the first argument to the function on its right, letting you chain several operations in a readable, top-to-bottom sequence. R now has two common versions: the native pipe |>, built into base R since version 4.1, and the older magrittr pipe %>%, which predates it and is still common in existing code. Writing data |> filter(x > 0) |> summarize(mean(x)) reads as a sequence of steps rather than a nested jumble of function calls.

Visit the following resources to learn more: