Skip to content

Commit

Permalink
- bug fix in arg checking #116
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
egouldo committed Sep 6, 2024
1 parent 0ba1c4c commit 20d7449
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions R/Z_VZ_preds.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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

Expand Down

0 comments on commit 20d7449

Please sign in to comment.