With R 4.3.0 released on Friday, you can now use an “underscore” with the built-in pipe, like you could use a “period” in maggittr pipe. While there are still some reasons to use maggittr, like T-pipes, assignment pipes and exposition pipes, I’ve never used them and they aren’t exported by default in the tidyverse.
For example, in maggittr you could do:
df %>% inner_join(states, .)
And now with the native pipe you can do the same thing:
df |> inner_join(states, _)
That was a major oversight when the created the native pipe, I’m not sure why it wasn’t originally implemented when 4.0.0 came out but it wasn’t.
Also, you can use _$value to extract something from R:
mtcars |> lm(mpg ~ disp, data = _) |> _$coef
Although, I’m not totally sure why you want to use a pipe like that when you can put the extractor directly on the lm:
mtcars |> lm(mpg ~ disp, data = _)$coef
Learn more about the changes in R 4.30: https://www.jumpingrivers.com/blog/whats-new-r43/
Get R version 4.3.0 (Already Tomorrow) which was released on 2023-04-21.
And here is the full list of changes in R 4.30.