For formal documentation please see https://github.com/WinVector/wrapr/blob/master/extras/wrapr_pipe.pdf.
apply_left(
pipe_left_arg,
pipe_right_arg,
pipe_environment,
left_arg_name,
pipe_string,
right_arg_name
)
left argument.
substitute(pipe_right_arg) argument.
environment to evaluate in.
name, if not NULL name of left argument.
character, name of pipe operator.
name, if not NULL name of right argument.
result
apply_left.character <- function(pipe_left_arg,
pipe_right_arg,
pipe_environment,
left_arg_name,
pipe_string,
right_arg_name) {
if(is.language(pipe_right_arg)) {
wrapr::apply_left_default(pipe_left_arg,
pipe_right_arg,
pipe_environment,
left_arg_name,
pipe_string,
right_arg_name)
} else {
paste(pipe_left_arg, pipe_right_arg)
}
}
setMethod(
wrapr::apply_right_S4,
signature = c(pipe_left_arg = "character", pipe_right_arg = "character"),
function(pipe_left_arg,
pipe_right_arg,
pipe_environment,
left_arg_name,
pipe_string,
right_arg_name) {
paste(pipe_left_arg, pipe_right_arg)
})
"a" %.>% 5 %.>% 7
#> Error: wrapr::apply_left.default does not allow piping into obvious concrete right-argument (clearly can't depend on left argument):
#> character
#> numeric
"a" %.>% toupper(.)
#> [1] "A"
q <- "z"
"a" %.>% q
#> [1] "a z"