Closed renkun-ken closed 9 years ago
Since %>>%
is a user-defined operator and has to deal with the priority issues with other symbols like ~
, then expressions using these symbols need to be enclosed in ()
to take effect. This can be simplified using pipeline()
which directly takes an expression
object so that I bring the syntax for special symbols inside ()
to an outer level, which does not affect %>>%
but allows pipeline()
to run the following code:
pipeline({
mtcars
~ cat("rows:", nrow(.))
lm(formula = mpg ~ wt + cyl)
summary
})
That is a very interesting idea, which may have opened a door to more possibilities.
In this post, @hoxo_m creates a very interesting function called
pipeR_world()
that allows users to build pipeline without using any noisy operator.Here's my simplified implementation: https://gist.github.com/renkun-ken/7060debc32cce49dc57d
This feature uses NSE at expression level and allows the following code:
If there's no critical potential problem about it, consider to support this feature in future.