In my package, I would like magrittr's pipe %>%
to have the same behaviour as the native pipe |>
, because I work on expressions and calls, and replacing .
in an expression is quite challenging.
I tried to create the following function
`%>%` <- function(...){
`|>`(...)
}
Unfortunately that does not work (function "|>" not found
). I wanted to investigate a little further to understand what native pipe |>
is and print the code.
> magrittr::`%>%`
function (lhs, rhs)
{
lhs <- substitute(lhs)
rhs <- substitute(rhs)
kind <- 1L
env <- parent.frame()
lazy <- TRUE
.External2(magrittr_pipe)
}
<bytecode: 0x55a4bb334560>
<environment: namespace:magrittr>
> `|>`
Error: object '|>' not found
> exists("|>")
[1] FALSE
I'm confused: even special functions such as if
do exist. If native pipe does not exist, what is it?