What are the differences between R’s native pipe `|>` and the magrittr pipe `%>%`?

In R 4.1 (May 2021) a native pipe operator was introduced that is “more streamlined” than previous implementations. I already noticed one difference between the native |> and the magrittr pipe %>%, namely 2 %>% sqrt works but 2 |> sqrt doesn’t and has to be written as 2 |> sqrt(). Are there more differences and pitfalls to be aware of when using the native pipe operator?

Leave a Comment