From 20d74494a169e2c37e42830c62a926fefa321b11 Mon Sep 17 00:00:00 2001 From: egouldo Date: Fri, 6 Sep 2024 17:09:33 +1000 Subject: [PATCH] - bug fix in arg checking #116 After discarding NA values if the length is less than the number of inputs (4) THEN trigger the warning / early exit from fn. Threshold check was too low (3). --- R/Z_VZ_preds.R | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/R/Z_VZ_preds.R b/R/Z_VZ_preds.R index af6e649..07cf662 100644 --- a/R/Z_VZ_preds.R +++ b/R/Z_VZ_preds.R @@ -12,10 +12,10 @@ Z_VZ_preds <- function(yi, yi_se, mu_p, sd_p) { # TODO should we pass in whole DF as arg instead of yi + yi_se?? # We want to be able to keep the values linked to their corresponding # scenario_value! - na_args <- purrr::discard(c(yi, yi_se, mu_p, sd_p), is.na) %>% + check_na_args <- purrr::discard(c(yi, yi_se, mu_p, sd_p), is.na) %>% length() - if (na_args < 3) { + if (check_na_args < 4) { cli::cli_alert_danger("Required values for computing Z/VZ predictions missing:") cli::cli_alert_warning("Returning {.val NA} for quadrupple:") cli::cli_ol(c( @@ -27,7 +27,6 @@ Z_VZ_preds <- function(yi, yi_se, mu_p, sd_p) { return(NA) } - Z <- (yi - mu_p) / sd_p VZ <- yi_se / sd_p