Searches column names of given data.frame to identify which start with the given pattern.
If the pattern given ends with 'N', it looks for variables that also end with N.
If the pattern does not end with 'N', it excludes variables that end with 'N' while returning
those that start with the pattern. eg. pattern = "BYVAR" may return c("BYVAR1","BYVAR2")
Whereas "BYVARN" may return c("BYVAR1N","BYVAR2N"), if they exist.
Examples
data("ae_pre_process")
ae_pre <- mentry(
datain = ae_pre_process$data,
subset = NA,
byvar = "AEBODSYS~SEX",
trtvar = "TRTA",
trtsort = "TRTAN",
subgrpvar = NA,
trttotalyn = "N",
add_grpmiss = "N",
sgtotalyn = "N",
pop_fil = "SAFFL"
)
var_start(ae_pre, "BYVARN")
#> [1] "BYVAR1N" "BYVAR2N"
var_start(ae_pre, "BYVAR")
#> [1] "BYVAR1" "BYVAR2"