More Pipes in R
Win-Vector Blog 2017-12-17
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.