The dplyr
R package has the %>%
operator, which is a custom infix operator. If one attaches the namespace with library(dplyr)
one can use this operator. In library code the library(dplyr)
at the top of the file has no effect because the environment after executing the source code is stored; loaded packages have no effect on that.
So in order to use this in my library, I have these options:
- Just use
library(dplyr)
at the beginning of each function. - Do not use the infix operator and rather write the functions with out the “pipe” operator
%>%
. - Try to use
dplyr::%>%
.
The last option is what I want to do, but I cannot seem to get the syntax right. I have tried
dplyr::%>%
and get parsing errors. Also
dplyr::`%>%`
does not work. And
`dplyr::%>%`
does not work either. I don't think that there is any other way to place the backticks. Is this something that is possible in R or do I just have to use option 1 or 2?