From d52f115df00f2aa57a8d88ddb8bd4be13b68bf66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?zxBIB=20Lech=C3=B3n=2CMiguel=20=28MED=20BDS=29=20EXTERNAL?= Date: Mon, 2 Dec 2024 14:40:12 +0100 Subject: [PATCH] Improved app creator messaging for blank visit values on lineplot. --- R/mod_lineplot.R | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/R/mod_lineplot.R b/R/mod_lineplot.R index 7d9cdfe..7718e16 100644 --- a/R/mod_lineplot.R +++ b/R/mod_lineplot.R @@ -1675,6 +1675,30 @@ check_mod_lineplot <- function( ) } + if (OK[["visit_vars"]] && OK[["cdisc_visit_vars"]]) { + ds <- datasets[[bm_dataset_name]] + for (visit_var in c(visit_vars, cdisc_visit_vars)) { + var_data <- ds[[visit_var]] + levs <- unique(var_data) + CM$assert( + container = err, + cond = all(nchar(trimws(levs)) > 0), + msg = sprintf( + paste( + "The visit variable `%s` in dataset `%s` contains missing (blank) values.", + "The lineplot module does not support those, since they lead to blank options in the visit selector", + "and to missing X axis labels on the resulting plot, which may be puzzling to up users.
", + "You can examine the affected variable with this command:
unique(%s[['%s']])
", + "Notice the blank value in the resulting output:", + "
%s
" + ), + visit_var, bm_dataset_name, bm_dataset_name, visit_var, + paste(capture.output(unique(ds[["VISIT"]])), collapse = "\n") + ) + ) + } + } + res <- list(warnings = warn[["messages"]], errors = err[["messages"]]) return(res) }