I am writing a package that uses tidyverse functions, i.e. that use non-standard evaluation, like dplyr::filter
for example:
setMethod("filter_by_id",
signature(x = "studies", id = "character"),
definition = function(x, id) {
study_id <- rlang::expr(study_id)
lst <- purrr::map(s4_to_list(x), ~ dplyr::filter(.x, !!study_id %in% id))
y <- list_to_s4(lst, "studies")
return(y)
})
I am using the !!
operator (and I will probably use a few more others from the rlang
package) and I am wondering if I need to explicitly import it as with the pipe-operator %>%
, as explained in this question: R: use magrittr pipe operator in self written package.
Is there something equivalent to usethis::use_pipe()
but for the operators from rlang
?