R/e_REDCap_use_dotfactor_var.R
e_REDCap_use_dotfactor_var.Rd
For the factor (categorical) variables, the non-".factor" variable name is a numeric class with the levels (and a variable label) while the ".factor" variable name is a factor class with the labels in the appropriate order (and no variable label). This function copies the variable label from the non-".factor" variable name to the ".factor" variable, then copies the ".factor" variable to the non-".factor" variable name. This makes the non-".factor" variable name have all the best attributes. Finally, drop all the ".factor" variables from the data.
e_REDCap_use_dotfactor_var(dat, var_names = NULL, sw_all_dotfactor = TRUE)
data.frame file to process
non-".factor" variable names to update
T/F to process all ".factor" variables
dat with updated non-".factor" variables
if (FALSE) {
# dat_temp <-
# e_REDCap_use_dotfactor_var(
# var_names = c("labs_bun_hl", "labs_cr_hl", "labs_elec_na_hl")
# , dat = dat_vci
# )
}