diff --git a/R/derive_merged.R b/R/derive_merged.R index 5019fa7c3a..73c90b6664 100644 --- a/R/derive_merged.R +++ b/R/derive_merged.R @@ -432,8 +432,11 @@ derive_vars_merged <- function(dataset, mutate(!!!update_missings) %>% remove_tmp_vars() } - dataset %>% - mutate(!!exist_flag_var := ifelse(is.na(!!exist_flag_var), false_value, !!exist_flag_var)) + if (!is.null(exist_flag_var)) { + dataset <- dataset %>% + mutate(!!exist_flag_var := ifelse(is.na(!!exist_flag_var), false_value, !!exist_flag_var)) + } + dataset } #' Merge a Categorization Variable