user_extra_mappings <- function(lfs_file_column_names) {
custom_variables <- tibble::tribble(
~lfs_name, ~new_name, ~type,
"MARSEX6", "SEX_AND_MARITAL_STATUS", "factor"
)
return(custom_variables)
}
lfs_compile("your_lfs_rds_directory", extra_mappings = user_extra_mappings)
user_extra_mappings <- function(lfs_file_column_names) {
# This will pick DEGCLS7 if it exists in the quarterly file,
# if not then DEGCLS, otherwise it'll return NA.
degree_class <- pick_var(c("DEGCLS7", "DEGCLS"), lfs_file_column_names)
custom_variables <- tibble::tribble(
~lfs_name, ~new_name, ~type,
"MARSEX6", "SEX_AND_MARITAL_STATUS", "factor",
degree_class, "DEGREE_CLASS", "factor"
)
return(custom_variables)
}
lfs_compile("your_lfs_rds_directory", extra_mappings = user_extra_mappings)