backpipe: backpipe

Description Usage Arguments Details References See Also Examples

Description

Creates backpiping operators

Usage

1
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

1
2
3
  backpipe('%>%')
  backpipe('%>>%', '%<<%')
                    

Example output

function (lhs, rhs) 
{
    lhs <- substitute(lhs)
    rhs <- substitute(rhs)
    parent = parent.frame()
    ca <- if (is.call(lhs) && deparse(lhs[[1]]) == backpipe) {
        rhs. <- call(pipe, rhs, lhs[[length(lhs)]])
        lhs. <- lhs[[2]]
        call(backpipe, lhs[[2]], rhs.)
    }
    else {
        call(pipe, rhs, lhs)
    }
    eval(ca, parent, parent)
}
<environment: 0x250b698>
function (lhs, rhs) 
{
    lhs <- substitute(lhs)
    rhs <- substitute(rhs)
    parent = parent.frame()
    ca <- if (is.call(lhs) && deparse(lhs[[1]]) == backpipe) {
        rhs. <- call(pipe, rhs, lhs[[length(lhs)]])
        lhs. <- lhs[[2]]
        call(backpipe, lhs[[2]], rhs.)
    }
    else {
        call(pipe, rhs, lhs)
    }
    eval(ca, parent, parent)
}
<environment: 0x250dd00>

backpipe documentation built on May 2, 2019, 5:41 a.m.