backpipes: %<%, %<<%
Description
Provides back-piping operators %<% (magrittr) or
%<<% (pipeR) allowing a reverses (right-to-left) order of
arguments
Usage
lhs %<% rhs
lhs %<<% rhs
Arguments
lhs
argument on the lhs of the backpipe
rhs
argument on the rhs of the backpipe
Details
-
%<%works with magrittr.%<<%works with piper. They are both based onbackpipe.
Other magrittr operators and complex expressions are not supported yet.
It is not possible to mix forward and and backward piping in the same expression because of likely ambiguous results.
References
https://github.com/smbache/magrittr/issues/26
http://stackoverflow.com/questions/31305342/is-right-to-left-operator-associativity-in-r-possible
See Also
Examples
## Not run:
require(magrittr)
letters %>% paste0( 1:26 ) # forward pipe
paste0( 1:26 ) %<% letters # backward pipe
mean %<% range( na.rm = TRUE ) %<% c(1:5, NA)
## End(Not run)
## Not run:
require(pipeR)
letters %>>% paste0( 1:26 ) # forward pipe
paste0( 1:26 ) %<<% letters # backward pipe
mean %<<% range( na.rm = TRUE ) %<<% c(1:5, NA)
## End(Not run)
## Not run:
require(shiny)
div( class="outer-outer") %<%
div( class="outer") %<%
div( class="inner") %<%
h1( "content", role="heading" )
## End(Not run)
backpipe
Description
Creates backpiping operators
Usage
backpipe(pipe, backpipe = gsub(">", "<", pipe))
Arguments
pipe
character; string representing the existing pipe operator
backpipe
character; string representing the desired backpipe operator
Details
Only pipe is necessary. Arbitrary mixing of forward and reverse are
not allowed.
References
https://github.com/smbache/magrittr/issues/26
http://stackoverflow.com/questions/31305342/is-right-to-left-operator-associativity-in-r-possible
See Also
Examples
backpipe('%>%')
backpipe('%>>%', '%<<%')
Insert backpipe
Description
Call this function to insert %<-% at the cursor position.
Usage
insert_backpipe()
Details
Use Tools > Modify Keyboard Shortcuts to bind a ->.; ->.;