library(dplyr, warn.conflicts = FALSE)
library(rlang)
example_fun <- function(by_vars) {
assert_vars(by_vars)
}
example_fun(exprs(USUBJID, PARAMCD))
try(example_fun(quos(USUBJID, PARAMCD)))
try(example_fun(c("USUBJID", "PARAMCD", "VISIT")))
try(example_fun(exprs(USUBJID, toupper(PARAMCD), desc(AVAL))))
example_fun_name <- function(by_vars) {
assert_vars(by_vars, expect_names = TRUE)
}
example_fun_name(exprs(APERSDT = APxxSDT, APEREDT = APxxEDT))
try(example_fun_name(exprs(APERSDT = APxxSDT, APxxEDT)))
Run the code above in your browser using DataLab