diff --git a/R/estimate_proportion.R b/R/estimate_proportion.R index a95a082418..f1273d9cc7 100644 --- a/R/estimate_proportion.R +++ b/R/estimate_proportion.R @@ -429,7 +429,7 @@ s_proportion <- function(df, } else if (checkmate::test_subset(method, c("strat_wilson", "strat_wilsonc"))) { stop("To use stratified methods you need to specify the strata variables.") } - if (missing(.var)) { + if (checkmate::test_atomic_vector(df)) { rsp <- as.logical(df) } else { rsp <- as.logical(df[[.var]]) diff --git a/man/estimate_proportions.Rd b/man/estimate_proportions.Rd index f16878cef8..a9f5fe493b 100644 --- a/man/estimate_proportions.Rd +++ b/man/estimate_proportions.Rd @@ -205,7 +205,8 @@ prop_jeffreys(rsp, conf_level = 0.95) # Case with only logical vector. -s_proportion(c(1, 0, 1, 0)) +rsp_v <- c(1, 0, 1, 0, 1, 1, 0, 0) +s_proportion(rsp_v) # Example for Stratified Wilson CI nex <- 100 # Number of example rows