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)

Arguments

dat

data.frame file to process

var_names

non-".factor" variable names to update

sw_all_dotfactor

T/F to process all ".factor" variables

Value

dat with updated non-".factor" variables

Examples

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
#   )
}