More Pipes in R
[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.
Was enjoying Gabriel’s article Pipes in R Tutorial For Beginners and wanted call attention to a few more pipes in R (not all for beginners).
- data.table has essentially used the square bracket sequence “
][
” in a manner equivalent to piping in R since about 2006. Here is an example. - The Bizarro Pipe “
->.;
” has always been possible in R, though I worked it out and started teaching it in 2016. And it is as quick to type as any other notation once you bind it to a keyboard shortcut. - Lately we have been using wrapr’s “dot pipe” “
%.>%
” under the theory that the placeholders may actually make sense as the primary objects in pipes (i.e., piping may be more about value sequencing than about function composition). - We toyed with the idea of adding a Kleisli arrow to R, and may get back to that one day.
The Kleisli arrow Khaleesi and dragon.
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.