[This article was first published on R – Win-Vector Blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
For many R users the magrittr
pipe is a popular way to arrange computation and famously part of the tidyverse
.
The tidyverse
itself is a rapidly evolving centrally controlled package collection. The tidyverse
authors publicly appear to be interested in re-basing the tidyverse
in terms of their new rlang
/tidyeval
package. So it is natural to wonder: what is the future of magrittr
(a pre-rlang
/tidyeval
package) in the tidyverse
?
For instance: here is a draft of rlang
/tidyeval
based pipe (from one of the primary rlang
/tidyeval
authors). This pipe even fixes dplyr
issue 2726:
# do NOT perform the source step directly! # Instead, save and inspect the source code from: # https://gist.github.com/lionel-/10cd649b31f11512e4aea3b7a98fe381 # Output printed is the result of an example in the gist. source("https://gist.githubusercontent.com/lionel-/10cd649b31f11512e4aea3b7a98fe381/raw/b8804e41424a4f721ce21292a7ec9c35b5f3689d/pipe.R") #> List of 1 #> $ :List of 1 #> ..$ :List of 2 #> .. ..$ : chr "foo" #> .. ..$ : chr "foo" # previously throwing example from dplyr issue 2726 (function(x) mtcars %>% dplyr::select(!!enquo(x)))(disp) %>% head() #> disp #> Mazda RX4 160 #> Mazda RX4 Wag 160 #> Datsun 710 108 #> Hornet 4 Drive 258 #> Hornet Sportabout 360 #> Valiant 225
To leave a comment for the author, please follow the link and comment on their blog: R – Win-Vector Blog.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.