diff --git a/R/create_individual_file.R b/R/create_individual_file.R index 675e2066a..6187bfecf 100644 --- a/R/create_individual_file.R +++ b/R/create_individual_file.R @@ -760,14 +760,12 @@ clean_individual_file <- function(individual_file, year) { cli::cli_alert_info("Clean individual file function started at {Sys.time()}") individual_file %>% - dplyr::select( - !c( - "ch_no_cost", - "no_paid_items", - "total_no_dn_contacts", - "cost_total_net_inc_dnas" - ) - ) %>% + dplyr::select(dplyr::any_of(!c( + "ch_no_cost", + "no_paid_items", + "total_no_dn_contacts", + "cost_total_net_inc_dnas" + ))) %>% clean_up_gender() %>% dplyr::mutate(age = compute_mid_year_age(year, .data$dob)) }