6 ms·
I use magrittr pipes pretty much exclusively because of the extra features relative to the native pipe, but I also respect the R devs' decision not to add those
by rcthompson 3y ago
I use magrittr pipes pretty much exclusively because of the extra features relative to the native pipe, but I also respect the R devs' decision not to add those extra features to the core of the language. The magrittr pipe adds additional syntax beyond the pipe itself, namely the '.' variable to refer to the piped value (essentially it's just Perl's '$_'). It's incredibly useful, but it's not particularly intuitive the way the basic pipe is.
- vasili111 3y agoAfter version 4.2 R native pipe also got place holder. It is “_” symbol. More here: https://davidbudzynski.github.io/general/2022/04/23/r-native-placeholder.html https://davidbudzynski.github.io/general/2022/04/23/r-native...
- rcthompson 3y agoYeah, but it's a single-use placeholder. AFAIK It can't do things like: x %>% set_names(., str_c("X_", names(.)) All the underscore does is let you pass the piped argument as a named argument instead of the first otherwise-unfilled argument.