Pipelines: magrittr
Thomas Mailund · Apress eBooks · 2022
Data analysis consists of several steps, where your data moves through different stages of transformations and cleaning before you finally get to model construction. In practical terms, this means that your R code will consist of a series of function calls where the output of one is the input of the next. The pattern is typical, but a straightforward implementation of it has several drawbacks. The Tidyverse has for many years provided a “pipe operator” to alleviate this, and with R 4.1, there is also a built-in operator in the language itself. Although this chapter is mainly about the magrittr pipe operator, %>% , I will describe the native |> operator as well and point out a few places where they differ in their behavior.