From c2262f94161e164c874b1ee1094ee821379fbc62 Mon Sep 17 00:00:00 2001 From: Dan Chaltiel <15105152+DanChaltiel@users.noreply.github.com> Date: Thu, 3 Oct 2024 16:03:47 +0200 Subject: [PATCH] better error in `edc_data_warn` when SUBJID is not found --- R/sanity_checks.R | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/R/sanity_checks.R b/R/sanity_checks.R index 352b586..65e2ce3 100644 --- a/R/sanity_checks.R +++ b/R/sanity_checks.R @@ -294,6 +294,10 @@ edc_data_condition = function(.data, message, issue_n, max_subjid, } if(!is.null(col_subjid)){ + if(!tolower(col_subjid) %in% tolower(names(.data))){ + cli_abort("Could not find column {col_subjid} in the input dataset.", + class="edc_data_condition_subjid_error", call=parent.frame()) + } subj = .data %>% pull(any_of2(col_subjid)) %>% unique() %>% sort() n_subj = length(subj) subj = paste0("#", subj) %>%