I want to use a user defined %operator%, for example %>% from magrittr, inside of a package, for example
xml2::xml_find_all(document, t$xpath)
} ) %>% purrr::flatten(.)
This doesn't work unless the code using the package has loaded magrittr.
What is the syntax for doing this so that the package does not depend on magrittr?
Here are some details...
A package cannot depend on a library being loaded, it must just import the library in it's DESCRIPTION file. This isn't a problem for functions because the package name can be used to scope the function as it is for purrr::flatten in the example above.
However the syntax to scope a user defined operator isn't obvious (to me :-()
What is the syntax to scope operators like %>%?
For example this, and a number of variations, does not work
xml2::xml_find_all(document, t$xpath)
} ) magrittr::`%>%` purrr::flatten(.)
Thanks,
Dan