library(dplyr)
library(rlang)
dm <- tribble(
~STUDYID, ~USUBJID,
"XYZ", "1",
"XYZ", "2"
)
example_fun <- function(dataset) {
assert_data_frame(dataset, required_vars = exprs(STUDYID, USUBJID))
}
example_fun(dm)
try(example_fun(select(dm, -STUDYID)))
try(example_fun("Not a dataset"))
try(example_fun(group_by(dm, USUBJID)))
Run the code above in your browser using DataLab