From 9412ebb7947389485b19ce99ffa30afb0d4373ea Mon Sep 17 00:00:00 2001 From: ddsjoberg Date: Wed, 18 Sep 2024 13:36:53 +0000 Subject: [PATCH] deploy: 9970baad97d8f813fe0570fa7c9467c65d5597ba --- main/coverage-report/index.html | 1836 +++++++++++++++---------------- 1 file changed, 918 insertions(+), 918 deletions(-) diff --git a/main/coverage-report/index.html b/main/coverage-report/index.html index 189d0712..d977e42e 100644 --- a/main/coverage-report/index.html +++ b/main/coverage-report/index.html @@ -95,7 +95,7 @@ font-size: 11px; }
-

cardx coverage - 95.35%

+

cardx coverage - 97.72%

-
- +
+
@@ -334,7 +334,7 @@

cardx coverage - 95.35%

32 - 17x + 23x
  set_cli_abort_call()
@@ -355,42 +355,42 @@

cardx coverage - 95.35%

35 - 17x + 23x
  check_not_missing(x)
36 - 17x + 23x
  check_binary(x)
37 - 17x + 23x
  check_range(conf.level, range = c(0, 1), include_bounds = c(FALSE, FALSE))
38 - 17x + 23x
  check_scalar(conf.level)
39 - 17x + 23x
  check_class(x = correct, "logical")
40 - 17x + 23x
  check_scalar(correct)
@@ -404,7 +404,7 @@

cardx coverage - 95.35%

42 - 17x + 23x
  x <- stats::na.omit(x)
@@ -418,35 +418,35 @@

cardx coverage - 95.35%

44 - 17x + 23x
  n <- length(x)
45 - 17x + 23x
  p_hat <- mean(x)
46 - 17x + 23x
  z <- stats::qnorm((1 + conf.level) / 2)
47 - 17x + 23x
  q_hat <- 1 - p_hat
48 - 17x + 23x
  correction_factor <- ifelse(correct, 1 / (2 * n), 0)
@@ -460,21 +460,21 @@

cardx coverage - 95.35%

50 - 17x + 23x
  err <- z * sqrt(p_hat * q_hat) / sqrt(n) + correction_factor
51 - 17x + 23x
  l_ci <- max(0, p_hat - err)
52 - 17x + 23x
  u_ci <- min(1, p_hat + err)
@@ -488,56 +488,56 @@

cardx coverage - 95.35%

54 - 17x + 23x
  list(
55 - 17x + 23x
    N = n,
56 - 17x + 23x
    estimate = p_hat,
57 - 17x + 23x
    conf.low = l_ci,
58 - 17x + 23x
    conf.high = u_ci,
59 - 17x + 23x
    conf.level = conf.level,
60 - 17x + 23x
    method =
61 - 17x + 23x
      glue::glue("Wald Confidence Interval {ifelse(correct, 'with', 'without')} continuity correction")
@@ -635,7 +635,7 @@

cardx coverage - 95.35%

75 - 5x + 14x
  set_cli_abort_call()
@@ -656,7 +656,7 @@

cardx coverage - 95.35%

78 - 5x + 14x
  check_pkg_installed(pkg = "broom", reference_pkg = "cardx")
@@ -677,42 +677,42 @@

cardx coverage - 95.35%

81 - 5x + 14x
  check_not_missing(x)
82 - 5x + 14x
  check_binary(x)
83 - 5x + 13x
  check_class(x = correct, "logical")
84 - 5x + 13x
  check_scalar(correct)
85 - 5x + 13x
  check_range(conf.level, range = c(0, 1), include_bounds = c(FALSE, FALSE))
86 - 5x + 13x
  check_scalar(conf.level)
@@ -726,7 +726,7 @@

cardx coverage - 95.35%

88 - 5x + 12x
  x <- stats::na.omit(x)
@@ -740,14 +740,14 @@

cardx coverage - 95.35%

90 - 5x + 12x
  n <- length(x)
91 - 5x + 12x
  y <- stats::prop.test(x = sum(x), n = n, correct = correct, conf.level = conf.level)
@@ -761,42 +761,42 @@

cardx coverage - 95.35%

93 - 5x + 12x
  list(N = n, conf.level = conf.level) |>
94 - 5x + 12x
    utils::modifyList(val = broom::tidy(y) |> as.list()) |>
95 - 5x + 12x
    utils::modifyList(
96 - 5x + 12x
      list(
97 - 5x + 12x
        method =
98 - 5x + 12x
          glue::glue("Wilson Confidence Interval {ifelse(correct, 'with', 'without')} continuity correction")
@@ -901,7 +901,7 @@

cardx coverage - 95.35%

113 - 2x + 5x
  set_cli_abort_call()
@@ -922,7 +922,7 @@

cardx coverage - 95.35%

116 - 2x + 5x
  check_pkg_installed(pkg = "broom", reference_pkg = "cardx")
@@ -943,28 +943,28 @@

cardx coverage - 95.35%

119 - 2x + 5x
  check_not_missing(x)
120 - 2x + 5x
  check_binary(x)
121 - 2x + 5x
  check_range(conf.level, range = c(0, 1), include_bounds = c(FALSE, FALSE))
122 - 2x + 5x
  check_scalar(conf.level)
@@ -978,14 +978,14 @@

cardx coverage - 95.35%

124 - 2x + 5x
  x <- stats::na.omit(x)
125 - 2x + 5x
  n <- length(x)
@@ -999,7 +999,7 @@

cardx coverage - 95.35%

127 - 2x + 5x
  y <- stats::binom.test(x = sum(x), n = n, conf.level = conf.level)
@@ -1013,21 +1013,21 @@

cardx coverage - 95.35%

129 - 2x + 5x
  list(N = n, conf.level = conf.level) |>
130 - 2x + 5x
    utils::modifyList(val = broom::tidy(y) |> as.list()) |>
131 - 2x + 5x
    utils::modifyList(list(method = "Clopper-Pearson Confidence Interval"))
@@ -1118,7 +1118,7 @@

cardx coverage - 95.35%

144 - 2x + 7x
  set_cli_abort_call()
@@ -1139,28 +1139,28 @@

cardx coverage - 95.35%

147 - 2x + 7x
  check_not_missing(x)
148 - 2x + 7x
  check_binary(x)
149 - 2x + 7x
  check_range(conf.level, range = c(0, 1), include_bounds = c(FALSE, FALSE))
150 - 2x + 7x
  check_scalar(conf.level)
@@ -1174,7 +1174,7 @@

cardx coverage - 95.35%

152 - 2x + 7x
  x <- stats::na.omit(x)
@@ -1188,21 +1188,21 @@

cardx coverage - 95.35%

154 - 2x + 7x
  n <- length(x)
155 - 2x + 7x
  x_sum <- sum(x)
156 - 2x + 7x
  z <- stats::qnorm((1 + conf.level) / 2)
@@ -1223,14 +1223,14 @@

cardx coverage - 95.35%

159 - 2x + 7x
  x_sum_tilde <- x_sum + z^2 / 2
160 - 2x + 7x
  n_tilde <- n + z^2
@@ -1251,35 +1251,35 @@

cardx coverage - 95.35%

163 - 2x + 7x
  p_tilde <- x_sum_tilde / n_tilde
164 - 2x + 7x
  q_tilde <- 1 - p_tilde
165 - 2x + 7x
  err <- z * sqrt(p_tilde * q_tilde) / sqrt(n_tilde)
166 - 2x + 7x
  l_ci <- max(0, p_tilde - err)
167 - 2x + 7x
  u_ci <- min(1, p_tilde + err)
@@ -1293,49 +1293,49 @@

cardx coverage - 95.35%

169 - 2x + 7x
  list(
170 - 2x + 7x
    N = n,
171 - 2x + 7x
    estimate = mean(x),
172 - 2x + 7x
    conf.low = l_ci,
173 - 2x + 7x
    conf.high = u_ci,
174 - 2x + 7x
    conf.level = conf.level,
175 - 2x + 7x
    method = "Agresti-Coull Confidence Interval"
@@ -1419,7 +1419,7 @@

cardx coverage - 95.35%

187 - 3x + 8x
  set_cli_abort_call()
@@ -1440,35 +1440,35 @@

cardx coverage - 95.35%

190 - 3x + 8x
  check_not_missing(x)
191 - 3x + 8x
  check_binary(x)
192 - 3x + 8x
  check_range(conf.level, range = c(0, 1), include_bounds = c(FALSE, FALSE))
193 - 3x + 8x
  check_scalar(conf.level)
194 - 3x + 8x
  x <- stats::na.omit(x)
@@ -1482,14 +1482,14 @@

cardx coverage - 95.35%

196 - 3x + 8x
  n <- length(x)
197 - 3x + 8x
  x_sum <- sum(x)
@@ -1503,35 +1503,35 @@

cardx coverage - 95.35%

199 - 3x + 8x
  alpha <- 1 - conf.level
200 - 3x + 8x
  l_ci <- ifelse(
201 - 3x + 8x
    x_sum == 0,
202 - 3x + 8x
    0,
203 - 3x + 8x
    stats::qbeta(alpha / 2, x_sum + 0.5, n - x_sum + 0.5)
@@ -1552,28 +1552,28 @@

cardx coverage - 95.35%

206 - 3x + 8x
  u_ci <- ifelse(
207 - 3x + 8x
    x_sum == n,
208 - 3x + 8x
    1,
209 - 3x + 8x
    stats::qbeta(1 - alpha / 2, x_sum + 0.5, n - x_sum + 0.5)
@@ -1594,49 +1594,49 @@

cardx coverage - 95.35%

212 - 3x + 8x
  list(
213 - 3x + 8x
    N = n,
214 - 3x + 8x
    estimate = mean(x),
215 - 3x + 8x
    conf.low = l_ci,
216 - 3x + 8x
    conf.high = u_ci,
217 - 3x + 8x
    conf.level = conf.level,
218 - 3x + 8x
    method = glue::glue("Jeffreys Interval")
@@ -2028,7 +2028,7 @@

cardx coverage - 95.35%

274 - 2x + 12x
  set_cli_abort_call()
@@ -2049,56 +2049,56 @@

cardx coverage - 95.35%

277 - 2x + 12x
  check_not_missing(x)
278 - 2x + 12x
  check_not_missing(strata)
279 - 2x + 12x
  check_binary(x)
280 - 2x + 12x
  check_class(correct, "logical")
281 - 2x + 12x
  check_scalar(correct)
282 - 2x + 12x
  check_class(strata, "factor")
283 - 2x + 12x
  check_range(conf.level, range = c(0, 1), include_bounds = c(FALSE, FALSE))
284 - 2x + 12x
  check_scalar(conf.level)
@@ -2119,28 +2119,28 @@

cardx coverage - 95.35%

287 - 2x + 12x
  is_na <- is.na(x) | is.na(strata)
288 - 2x + 12x
  x <- x[!is_na]
289 - 2x + 12x
  strata <- strata[!is_na]
- + 290 - ! + 6x
  if (!inherits(x, "logical")) x <- as.logical(x)
@@ -2154,14 +2154,14 @@

cardx coverage - 95.35%

292 - 2x + 12x
  if (all(x) || all(!x)) {
- + 293 - ! + 2x
    cli::cli_abort("All values in {.arg x} argument are either {.code TRUE} or {.code FALSE} and CI is not estimable.")
@@ -2182,14 +2182,14 @@

cardx coverage - 95.35%

296 - 2x + 10x
  tbl <- table(factor(x, levels = c(FALSE, TRUE)), strata, useNA = "no")
297 - 2x + 10x
  n_strata <- length(unique(strata))
@@ -2210,28 +2210,28 @@

cardx coverage - 95.35%

300 - 2x + 10x
  do_iter <- FALSE
301 - 2x + 10x
  if (is.null(weights)) {
- + 302 - ! + 3x
    weights <- rep(1 / n_strata, n_strata) # Initialization for iterative procedure
- + 303 - ! + 3x
    do_iter <- TRUE
@@ -2250,16 +2250,16 @@

cardx coverage - 95.35%

    # Iteration parameters
- + 306 - ! + 3x
    if (!is_scalar_integerish(max.iterations) || max.iterations < 1) {
- + 307 - ! + 2x
      cli::cli_abort("Argument {.arg max.iterations} must be a positive integer.")
@@ -2280,42 +2280,42 @@

cardx coverage - 95.35%

310 - 2x + 8x
  check_range(weights, range = c(0, 1), include_bounds = c(TRUE, TRUE))
311 - 2x + 7x
  sum_weights <- sum(weights) |>
312 - 2x + 7x
    round() |>
313 - 2x + 7x
    as.integer()
314 - 2x + 7x
  if (sum_weights != 1L || abs(sum_weights - sum(weights)) > sqrt(.Machine$double.eps)) {
- + 315 - ! + 1x
    cli::cli_abort("The sum of the {.arg weights} argument must be {.val {1L}}")
@@ -2336,49 +2336,49 @@

cardx coverage - 95.35%

318 - 2x + 6x
  xs <- tbl["TRUE", ]
319 - 2x + 6x
  ns <- colSums(tbl)
320 - 2x + 6x
  use_stratum <- (ns > 0)
321 - 2x + 6x
  ns <- ns[use_stratum]
322 - 2x + 6x
  xs <- xs[use_stratum]
323 - 2x + 6x
  ests <- xs / ns
324 - 2x + 6x
  vars <- ests * (1 - ests) / ns
@@ -2392,7 +2392,7 @@

cardx coverage - 95.35%

326 - 2x + 6x
  strata_qnorm <- .strata_normal_quantile(vars, weights, conf.level)
@@ -2413,14 +2413,14 @@

cardx coverage - 95.35%

329 - 2x + 6x
  weights_new <- if (do_iter) {
- + 330 - ! + 1x
    .update_weights_strat_wilson(vars, strata_qnorm, weights, ns, max.iterations, conf.level)$weights
@@ -2434,7 +2434,7 @@

cardx coverage - 95.35%

332 - 2x + 5x
    weights
@@ -2455,7 +2455,7 @@

cardx coverage - 95.35%

335 - 2x + 6x
  strata_conf.level <- 2 * stats::pnorm(strata_qnorm) - 1
@@ -2469,14 +2469,14 @@

cardx coverage - 95.35%

337 - 2x + 6x
  ci_by_strata <- Map(
338 - 2x + 6x
    function(x, n) {
@@ -2490,7 +2490,7 @@

cardx coverage - 95.35%

340 - 12x + 36x
      suppressWarnings(stats::prop.test(x, n, correct = correct, conf.level = strata_conf.level)$conf.int)
@@ -2504,14 +2504,14 @@

cardx coverage - 95.35%

342 - 2x + 6x
    x = xs,
343 - 2x + 6x
    n = ns
@@ -2525,14 +2525,14 @@

cardx coverage - 95.35%

345 - 2x + 6x
  lower_by_strata <- sapply(ci_by_strata, "[", 1L)
346 - 2x + 6x
  upper_by_strata <- sapply(ci_by_strata, "[", 2L)
@@ -2546,14 +2546,14 @@

cardx coverage - 95.35%

348 - 2x + 6x
  lower <- sum(weights_new * lower_by_strata)
349 - 2x + 6x
  upper <- sum(weights_new * upper_by_strata)
@@ -2574,63 +2574,63 @@

cardx coverage - 95.35%

352 - 2x + 6x
  list(
353 - 2x + 6x
    N = length(x),
354 - 2x + 6x
    estimate = mean(x),
355 - 2x + 6x
    conf.low = lower,
356 - 2x + 6x
    conf.high = upper,
357 - 2x + 6x
    conf.level = conf.level,
358 - 2x + 6x
    weights = if (do_iter) weights_new else NULL,
359 - 2x + 6x
    method =
360 - 2x + 6x
      glue::glue("Stratified Wilson Confidence Interval {ifelse(correct, 'with', 'without')} continuity correction")
@@ -2644,7 +2644,7 @@

cardx coverage - 95.35%

362 - 2x + 6x
    compact()
@@ -2693,7 +2693,7 @@

cardx coverage - 95.35%

369 - 525x + 526x
  is.logical(x) || (is_integerish(x) && is_empty(setdiff(x, c(0, 1, NA))))
@@ -2903,7 +2903,7 @@

cardx coverage - 95.35%

399 - 2x + 8x
  summands <- weights^2 * vars
@@ -2917,7 +2917,7 @@

cardx coverage - 95.35%

401 - 2x + 8x
  sqrt(sum(summands)) / sum(sqrt(summands)) * stats::qnorm((1 + conf.level) / 2)
@@ -3174,16 +3174,16 @@

cardx coverage - 95.35%

                                         tol = 0.001) {
- + 438 - ! + 1x
  it <- 0
- + 439 - ! + 1x
  diff_v <- NULL
@@ -3195,72 +3195,72 @@

cardx coverage - 95.35%


                     
                   
-                  
+                  
                     441
-                    !
+                    1x
                     
                       
  while (it < max.iterations) {
- + 442 - ! + 2x
    it <- it + 1
- + 443 - ! + 2x
    weights_new_t <- (1 + strata_qnorm^2 / n_per_strata)^2
- + 444 - ! + 2x
    weights_new_b <- (vars + strata_qnorm^2 / (4 * n_per_strata^2))
- + 445 - ! + 2x
    weights_new <- weights_new_t / weights_new_b
- + 446 - ! + 2x
    weights_new <- weights_new / sum(weights_new)
- + 447 - ! + 2x
    strata_qnorm <- .strata_normal_quantile(vars, weights_new, conf.level)
- + 448 - ! + 2x
    diff_v <- c(diff_v, sum(abs(weights_new - initial_weights)))
- + 449 - ! + 1x
    if (diff_v[length(diff_v)] < tol) break
- + 450 - ! + 1x
    initial_weights <- weights_new
@@ -3279,9 +3279,9 @@

cardx coverage - 95.35%


                     
                   
-                  
+                  
                     453
-                    !
+                    1x
                     
                       
  if (it == max.iterations) {
@@ -3307,30 +3307,30 @@

cardx coverage - 95.35%


                     
                   
-                  
+                  
                     457
-                    !
+                    1x
                     
                       
  list(
- + 458 - ! + 1x
    "n_it" = it,
- + 459 - ! + 1x
    "weights" = weights_new,
- + 460 - ! + 1x
    "diff_v" = diff_v
@@ -6519,28 +6519,28 @@

cardx coverage - 95.35%

60 - 78x + 83x
  set_cli_abort_call()
61 - 78x + 83x
  check_pkg_installed(pkg = "survey", reference_pkg = "cardx")
62 - 78x + 83x
  check_dots_empty()
63 - 78x + 83x
  deff <- TRUE # we may update in the future to make this an argument for users
@@ -6561,35 +6561,35 @@

cardx coverage - 95.35%

66 - 78x + 83x
  check_not_missing(variables)
67 - 78x + 83x
  cards::process_selectors(
68 - 78x + 83x
    data = data$variables,
69 - 78x + 83x
    variables = {{ variables }},
70 - 78x + 83x
    by = {{ by }}
@@ -6603,14 +6603,14 @@

cardx coverage - 95.35%

72 - 78x + 83x
  variables <- setdiff(variables, by)
73 - 78x + 83x
  check_scalar(by, allow_empty = TRUE)
@@ -6631,7 +6631,7 @@

cardx coverage - 95.35%

76 - 78x + 83x
  if (is_empty(variables)) {
@@ -6659,7 +6659,7 @@

cardx coverage - 95.35%

80 - 78x + 83x
  check_na_factor_levels(data$variables, c(by, variables))
@@ -6673,35 +6673,35 @@

cardx coverage - 95.35%

82 - 78x + 83x
  cards::process_formula_selectors(
83 - 78x + 83x
    data = data$variables[variables],
84 - 78x + 83x
    statistic = statistic,
85 - 78x + 83x
    fmt_fn = fmt_fn,
86 - 78x + 83x
    stat_label = stat_label
@@ -6715,21 +6715,21 @@

cardx coverage - 95.35%

88 - 78x + 83x
  cards::fill_formula_selectors(
89 - 78x + 83x
    data = data$variables[variables],
90 - 78x + 83x
    statistic = formals(asNamespace("cardx")[["ard_categorical.survey.design"]])[["statistic"]] |> eval(),
@@ -6743,42 +6743,42 @@

cardx coverage - 95.35%

92 - 78x + 83x
  accepted_svy_stats <- c("n", "N", "p", "p.std.error", "deff", "n_unweighted", "N_unweighted", "p_unweighted")
93 - 78x + 83x
  cards::check_list_elements(
94 - 78x + 83x
    x = statistic,
95 - 78x + 83x
    predicate = \(x) all(x %in% accepted_svy_stats),
96 - 78x + 83x
    error_msg = c("Error in the values of the {.arg statistic} argument.",
97 - 78x + 83x
      i = "Values must be in {.val {accepted_svy_stats}}"
@@ -6799,7 +6799,7 @@

cardx coverage - 95.35%

100 - 78x + 83x
  denominator <- arg_match(denominator)
@@ -6820,49 +6820,49 @@

cardx coverage - 95.35%

103 - 78x + 83x
  walk(
104 - 78x + 83x
    variables,
105 - 78x + 83x
    \(.x) {
106 - 144x + 149x
      if (all(is.na(data$variables[[.x]])) && !inherits(.x, c("logical", "factor"))) {
107 - 1x + 3x
        cli::cli_abort(
108 - 1x + 3x
          c("Column {.val {.x}} is all missing and cannot be tabulated.",
109 - 1x + 3x
            i = "Only columns of class {.cls logical} and {.cls factor} can be tabulated when all values are missing."
@@ -6876,7 +6876,7 @@

cardx coverage - 95.35%

111 - 1x + 3x
          call = get_cli_abort_call()
@@ -6925,28 +6925,28 @@

cardx coverage - 95.35%

118 - 77x + 80x
  if (any(by %in% c("variable", "variable_level", "group1_level", "p", "n"))) {
119 - 1x + 2x
    cli::cli_abort(
120 - 1x + 2x
      "The {.arg by} argument cannot include variables named {.val {c('variable', 'variable_level', 'group1_level', 'p', 'n')}}.",
121 - 1x + 2x
      call = get_cli_abort_call()
@@ -6974,28 +6974,28 @@

cardx coverage - 95.35%

125 - 76x + 78x
  if (any(variables %in% c("by", "name", "n", "p", "p.std.error"))) {
- + 126 - ! + 2x
    cli::cli_abort(
- + 127 - ! + 2x
      "The {.arg variables} argument cannot include variables named {.val {c('by', 'name', 'n', 'p', 'p.std.error')}}.",
- + 128 - ! + 2x
      call = get_cli_abort_call()
@@ -7653,28 +7653,28 @@

cardx coverage - 95.35%

222 - 127x + 132x
  walk(
223 - 127x + 132x
    variables,
224 - 127x + 132x
    \(variable) {
225 - 246x + 258x
      if (is.factor(data[[variable]]) && any(is.na(levels(data[[variable]])))) {
@@ -10753,7 +10753,7 @@

cardx coverage - 95.35%

67 - 17x + 26x
  UseMethod("construct_model")
@@ -10795,7 +10795,7 @@

cardx coverage - 95.35%

73 - 16x + 22x
  set_cli_abort_call()
@@ -10809,14 +10809,14 @@

cardx coverage - 95.35%

75 - 16x + 22x
  check_dots_empty()
76 - 16x + 22x
  check_pkg_installed(c("withr", package), reference_pkg = "cardx")
@@ -10830,14 +10830,14 @@

cardx coverage - 95.35%

78 - 16x + 22x
  check_not_missing(formula)
79 - 16x + 22x
  check_class(formula, cls = "formula")
@@ -10851,21 +10851,21 @@

cardx coverage - 95.35%

81 - 16x + 22x
  check_not_missing(method)
82 - 16x + 22x
  check_string_or_function(method)
83 - 16x + 18x
  if (is_string(method)) check_not_namespaced(method)
@@ -10886,7 +10886,7 @@

cardx coverage - 95.35%

86 - 14x + 19x
  method.args <- .as_list_of_exprs({{ method.args }})
@@ -10907,7 +10907,7 @@

cardx coverage - 95.35%

89 - 14x + 19x
  call_to_run <- call2(.fn = method, formula = formula, data = data, !!!method.args)
@@ -10921,28 +10921,28 @@

cardx coverage - 95.35%

91 - 14x + 19x
  try_fetch(
92 - 14x + 19x
    withr::with_namespace(
93 - 14x + 19x
      package = package,
94 - 14x + 19x
      eval_tidy(call_to_run, env = env)
@@ -10956,35 +10956,35 @@

cardx coverage - 95.35%

96 - 14x + 19x
    error = function(e) {
- + 97 - ! + 2x
      msg <- "There was an error evaluating the model"
98 - 14x + 19x
      if (is_string(method)) {
- + 99 - ! + 1x
        call_to_run$data <- expr(.)
- + 100 - ! + 1x
        msg <- paste(msg, "{.code {truncate_call(call_to_run)}}")
@@ -11003,30 +11003,30 @@

cardx coverage - 95.35%


                     
                   
-                  
+                  
                     103
-                    !
+                    2x
                     
                       
      cli::cli_abort(
- + 104 - ! + 2x
        message = msg,
- + 105 - ! + 2x
        parent = e,
- + 106 - ! + 2x
        call = get_cli_abort_call()
@@ -11089,7 +11089,7 @@

cardx coverage - 95.35%

115 - 1x + 4x
  set_cli_abort_call()
@@ -11103,14 +11103,14 @@

cardx coverage - 95.35%

117 - 1x + 4x
  check_dots_empty()
118 - 1x + 4x
  check_pkg_installed(c("withr", package), reference_pkg = "cardx")
@@ -11124,14 +11124,14 @@

cardx coverage - 95.35%

120 - 1x + 4x
  check_not_missing(formula)
121 - 1x + 4x
  check_class(formula, cls = "formula")
@@ -11145,21 +11145,21 @@

cardx coverage - 95.35%

123 - 1x + 4x
  check_not_missing(method)
124 - 1x + 4x
  check_string_or_function(method)
125 - 1x + 4x
  if (is_string(method)) check_not_namespaced(method)
@@ -11180,7 +11180,7 @@

cardx coverage - 95.35%

128 - 1x + 4x
  method.args <- .as_list_of_exprs({{ method.args }})
@@ -11201,7 +11201,7 @@

cardx coverage - 95.35%

131 - 1x + 4x
  call_to_run <- call2(.fn = method, formula = formula, design = data, !!!method.args)
@@ -11215,28 +11215,28 @@

cardx coverage - 95.35%

133 - 1x + 4x
  try_fetch(
134 - 1x + 4x
    withr::with_namespace(
135 - 1x + 4x
      package = package,
136 - 1x + 4x
      eval_tidy(call_to_run, env = env)
@@ -11250,35 +11250,35 @@

cardx coverage - 95.35%

138 - 1x + 4x
    error = function(e) {
- + 139 - ! + 2x
      msg <- "There was an error evaluating the model"
- + 140 - ! + 2x
      if (is_string(method)) {
- + 141 - ! + 2x
        call_to_run$design <- expr(.)
- + 142 - ! + 2x
        msg <- paste(msg, "{.code {truncate_call(call_to_run)}}")
@@ -11297,30 +11297,30 @@

cardx coverage - 95.35%


                     
                   
-                  
+                  
                     145
-                    !
+                    2x
                     
                       
      cli::cli_abort(
- + 146 - ! + 2x
        message = msg,
- + 147 - ! + 2x
        parent = e,
- + 148 - ! + 2x
        call = get_cli_abort_call()
@@ -11369,21 +11369,21 @@

cardx coverage - 95.35%

155 - 15x + 24x
  x_enexpr <- enexpr(x)
156 - 15x + 24x
  if (is_call_simple(x_enexpr)) {
157 - 15x + 24x
    return(call_args(x_enexpr))
@@ -11523,35 +11523,35 @@

cardx coverage - 95.35%

177 - 1036x + 1041x
  stats::reformulate(
178 - 1036x + 1041x
    termlabels = bt(termlabels),
179 - 1036x + 1041x
    response = bt(response),
180 - 1036x + 1041x
    intercept = intercept,
181 - 1036x + 1041x
    env = env
@@ -11621,14 +11621,14 @@

cardx coverage - 95.35%

191 - 2132x + 2144x
  if (is_empty(x)) {
192 - 1013x + 1018x
    return(x)
@@ -11649,28 +11649,28 @@

cardx coverage - 95.35%

195 - 1119x + 1126x
  ifelse(
196 - 1119x + 1126x
    make.names(x) != x & !str_detect(x, "^`.*`$"),
197 - 1119x + 1126x
    paste0("`", x, "`"),
198 - 1119x + 1126x
    x
@@ -11717,30 +11717,30 @@

cardx coverage - 95.35%

bt_strip <- function(x) {
- + 205 - ! + 1x
  ifelse(
- + 206 - ! + 1x
    str_detect(x, "^`.*`$"),
- + 207 - ! + 1x
    substr(x, 2, nchar(x) - 1),
- + 208 - ! + 1x
    x
@@ -11796,7 +11796,7 @@

cardx coverage - 95.35%

216 - 17x + 23x
  check_string(x, arg_name = arg_name, call = call, class = "check_not_namespaced")
@@ -11810,35 +11810,35 @@

cardx coverage - 95.35%

218 - 17x + 23x
  if (str_detect(x, "::")) {
219 - 2x + 3x
    cli::cli_abort(
220 - 2x + 3x
      "Argument {.arg {arg_name}} cannot be namespaced when passed as a {.cls string}.",
221 - 2x + 3x
      call = call,
222 - 2x + 3x
      class = class
@@ -11866,7 +11866,7 @@

cardx coverage - 95.35%

226 - 15x + 20x
  invisible(x)
@@ -11922,35 +11922,35 @@

cardx coverage - 95.35%

234 - 17x + 26x
  if (!is.function(x) && !is_string(x)) {
- + 235 - ! + 1x
    cli::cli_abort(
- + 236 - ! + 1x
      c("Argument {.arg {arg_name}} must be a {.cls string} or {.cls function}."),
- + 237 - ! + 1x
      call = call,
- + 238 - ! + 1x
      class = class
@@ -11978,7 +11978,7 @@

cardx coverage - 95.35%

242 - 17x + 25x
  invisible(x)
@@ -12004,16 +12004,16 @@

cardx coverage - 95.35%

truncate_call <- function(call, max_out = 100) {
- + 246 - ! + 3x
  call_text <- expr_text(call)
- + 247 - ! + 3x
  if (nchar(call_text) > max_out) {
@@ -12032,9 +12032,9 @@

cardx coverage - 95.35%

  }
- + 250 - ! + 3x
  call_text
@@ -12334,14 +12334,14 @@

cardx coverage - 95.35%

41 - 24x + 25x
  check_not_missing(data)
42 - 24x + 25x
  UseMethod("ard_categorical_ci")
@@ -12481,14 +12481,14 @@

cardx coverage - 95.35%

62 - 11x + 12x
  set_cli_abort_call()
63 - 11x + 12x
  check_dots_empty()
@@ -12509,7 +12509,7 @@

cardx coverage - 95.35%

66 - 11x + 12x
  check_pkg_installed(pkg = "broom", reference_pkg = "cardx")
@@ -12530,35 +12530,35 @@

cardx coverage - 95.35%

69 - 11x + 12x
  cards::process_selectors(data, variables = {{ variables }}, by = {{ by }})
70 - 11x + 12x
  method <- arg_match(method)
71 - 11x + 12x
  if (method %in% c("strat_wilson", "strat_wilsoncc")) {
72 - 1x + 2x
    cards::process_selectors(data, strata = strata)
73 - 1x + 2x
    check_scalar(strata)
@@ -12572,21 +12572,21 @@

cardx coverage - 95.35%

75 - 11x + 12x
  cards::process_formula_selectors(
76 - 11x + 12x
    data[variables],
77 - 11x + 12x
    value = value
@@ -12600,7 +12600,7 @@

cardx coverage - 95.35%

79 - 11x + 12x
  check_not_missing(variables)
@@ -12621,7 +12621,7 @@

cardx coverage - 95.35%

82 - 11x + 12x
  if (is_empty(variables)) {
@@ -12656,28 +12656,28 @@

cardx coverage - 95.35%

87 - 11x + 12x
  map(
88 - 11x + 12x
    variables,
89 - 11x + 12x
    function(variable) {
90 - 19x + 20x
      levels <- .unique_values_sort(data, variable = variable, value = value[[variable]])
@@ -12691,63 +12691,63 @@

cardx coverage - 95.35%

92 - 19x + 20x
      .calculate_ard_proportion(
93 - 19x + 20x
        data = .as_dummy(data, variable = variable, levels = levels, by = by, strata = strata),
94 - 19x + 20x
        variables = c(everything(), -all_of(c(by, strata))),
95 - 19x + 20x
        by = all_of(by),
96 - 19x + 20x
        method = method,
97 - 19x + 20x
        conf.level = conf.level,
98 - 19x + 20x
        strata = strata,
99 - 19x + 20x
        weights = weights,
100 - 19x + 20x
        max.iterations = max.iterations
@@ -12768,35 +12768,35 @@

cardx coverage - 95.35%

103 - 19x + 20x
        dplyr::left_join(
104 - 19x + 20x
          dplyr::select(., "variable") |>
105 - 19x + 20x
            dplyr::distinct() |>
106 - 19x + 20x
            dplyr::mutate(variable_level = as.list(.env$levels)),
107 - 19x + 20x
          by = "variable"
@@ -12817,14 +12817,14 @@

cardx coverage - 95.35%

110 - 19x + 20x
        dplyr::mutate(variable = .env$variable) |>
111 - 19x + 20x
        dplyr::relocate("variable_level", .after = "variable")
@@ -12845,7 +12845,7 @@

cardx coverage - 95.35%

114 - 11x + 12x
    dplyr::bind_rows()
@@ -12873,140 +12873,140 @@

cardx coverage - 95.35%

118 - 19x + 20x
  cards::ard_complex(
119 - 19x + 20x
    data = data,
120 - 19x + 20x
    variables = {{ variables }},
121 - 19x + 20x
    by = {{ by }},
122 - 19x + 20x
    statistic =
123 - 19x + 20x
      ~ list(
124 - 19x + 20x
        prop_ci =
125 - 19x + 20x
          switch(method,
126 - 19x + 20x
            "waldcc" = \(x, ...) proportion_ci_wald(x, conf.level = conf.level, correct = TRUE),
127 - 19x + 20x
            "wald" = \(x, ...) proportion_ci_wald(x, conf.level = conf.level, correct = FALSE),
128 - 19x + 20x
            "wilsoncc" = \(x, ...) proportion_ci_wilson(x, conf.level = conf.level, correct = TRUE),
129 - 19x + 20x
            "wilson" = \(x, ...) proportion_ci_wilson(x, conf.level = conf.level, correct = FALSE),
130 - 19x + 20x
            "clopper-pearson" = \(x, ...) proportion_ci_clopper_pearson(x, conf.level = conf.level),
131 - 19x + 20x
            "agresti-coull" = \(x, ...) proportion_ci_agresti_coull(x, conf.level = conf.level),
132 - 19x + 20x
            "jeffreys" = \(x, ...) proportion_ci_jeffreys(x, conf.level = conf.level),
133 - 19x + 20x
            "strat_wilsoncc" = \(x, data, ...) {
- + 134 - ! + 1x
              proportion_ci_strat_wilson(x,
- + 135 - ! + 1x
                strata = data[[strata]], weights = weights,
- + 136 - ! + 1x
                max.iterations = max.iterations,
- + 137 - ! + 1x
                conf.level = conf.level, correct = TRUE
@@ -13027,7 +13027,7 @@

cardx coverage - 95.35%

140 - 19x + 20x
            "strat_wilson" = \(x, data, ...) {
@@ -13097,14 +13097,14 @@

cardx coverage - 95.35%

150 - 19x + 20x
    dplyr::mutate(
151 - 19x + 20x
      context = "proportion_ci"
@@ -13139,7 +13139,7 @@

cardx coverage - 95.35%

156 - 249x + 250x
  unique_levels <-
@@ -13153,21 +13153,21 @@

cardx coverage - 95.35%

158 - 249x + 250x
    if (is.logical(data[[variable]])) c(TRUE, FALSE)
159 - 249x + 250x
  else if (is.factor(data[[variable]])) factor(levels(data[[variable]]), levels = levels(data[[variable]]))
160 - 249x + 250x
  else unique(data[[variable]]) |> sort()
@@ -13188,7 +13188,7 @@

cardx coverage - 95.35%

163 - 249x + 250x
  if (!is_empty(value) && !value %in% unique_levels) {
@@ -13251,14 +13251,14 @@

cardx coverage - 95.35%

172 - 249x + 250x
  if (!is_empty(value)) {
173 - 18x + 19x
    unique_levels <- value
@@ -13279,7 +13279,7 @@

cardx coverage - 95.35%

176 - 249x + 250x
  unique_levels
@@ -13314,28 +13314,28 @@

cardx coverage - 95.35%

181 - 19x + 20x
  map(levels, ~ data[[variable]] == .x) |>
182 - 19x + 20x
    set_names(paste0("this_is_not_a_column_name_anyone_would_choose_", variable, "_", levels, "...")) %>%
183 - 19x + 20x
    {dplyr::tibble(!!!.)} |> # styler: off
184 - 19x + 20x
    dplyr::bind_cols(data[c(by, strata)])
@@ -15467,7 +15467,7 @@

cardx coverage - 95.35%

29 - 3x + 6x
  set_cli_abort_call()
@@ -15488,7 +15488,7 @@

cardx coverage - 95.35%

32 - 3x + 6x
  check_pkg_installed(c("survey", "broom"), reference_pkg = "cardx")
@@ -15509,42 +15509,42 @@

cardx coverage - 95.35%

35 - 3x + 6x
  check_not_missing(data)
36 - 3x + 6x
  check_not_missing(variables)
37 - 3x + 6x
  check_not_missing(by)
38 - 3x + 6x
  check_class(data, cls = "survey.design")
39 - 3x + 6x
  cards::process_selectors(data[["variables"]], by = {{ by }}, variables = {{ variables }})
40 - 3x + 6x
  check_scalar(by)
@@ -15565,7 +15565,7 @@

cardx coverage - 95.35%

43 - 3x + 6x
  if (is_empty(variables)) {
@@ -15600,56 +15600,56 @@

cardx coverage - 95.35%

48 - 3x + 6x
  lapply(
49 - 3x + 6x
    variables,
50 - 3x + 6x
    function(variable) {
51 - 4x + 8x
      cards::tidy_as_ard(
52 - 4x + 8x
        lst_tidy =
53 - 4x + 8x
          cards::eval_capture_conditions(
54 - 4x + 8x
            survey::svychisq(reformulate2(termlabels = c(variable, by)), design = data, statistic = statistic, ...) |>
55 - 4x + 8x
              broom::tidy()
@@ -15663,21 +15663,21 @@

cardx coverage - 95.35%

57 - 4x + 8x
        tidy_result_names = c("statistic", "p.value", "ndf", "ddf", "method"),
58 - 4x + 8x
        passed_args = dots_list(...),
59 - 4x + 8x
        lst_ard_columns = list(group1 = by, variable = variable, context = "survey_svychisq")
@@ -15691,63 +15691,63 @@

cardx coverage - 95.35%

61 - 4x + 8x
        dplyr::mutate(
62 - 4x + 8x
          .after = "stat_name",
63 - 4x + 8x
          stat_label =
64 - 4x + 8x
            dplyr::case_when(
65 - 4x + 8x
              .data$stat_name %in% "statistic" ~ "Statistic",
66 - 4x + 8x
              .data$stat_name %in% "p.value" ~ "p-value",
67 - 4x + 8x
              .data$stat_name %in% "ndf" ~ "Nominator Degrees of Freedom",
68 - 4x + 8x
              .data$stat_name %in% "ddf" ~ "Denominator Degrees of Freedom",
69 - 4x + 8x
              TRUE ~ .data$stat_name,
@@ -15782,14 +15782,14 @@

cardx coverage - 95.35%

74 - 3x + 6x
    dplyr::bind_rows() |>
75 - 3x + 6x
    cards::as_card()
@@ -16243,7 +16243,7 @@

cardx coverage - 95.35%

63 - 13x + 17x
  set_cli_abort_call()
@@ -16264,7 +16264,7 @@

cardx coverage - 95.35%

66 - 13x + 17x
  check_pkg_installed(c("survival", "broom"), reference_pkg = "cardx")
@@ -16285,21 +16285,21 @@

cardx coverage - 95.35%

69 - 13x + 17x
  check_not_missing(x)
70 - 13x + 17x
  check_class(x, cls = "survfit")
71 - 12x + 16x
  if (inherits(x, "survfitcox")) {
@@ -16348,7 +16348,7 @@

cardx coverage - 95.35%

78 - 11x + 15x
  if (inherits(x, c("survfitms", "survfitcoxms")) && !is.null(type)) {
@@ -16383,21 +16383,21 @@

cardx coverage - 95.35%

83 - 1x + 4x
  if (!is.null(probs)) check_range(probs, c(0, 1))
84 - 11x + 15x
  if (sum(is.null(times), is.null(probs)) != 1) {
- + 85 - ! + 1x
    cli::cli_abort("One and only one of {.arg times} and {.arg probs} must be specified.")
@@ -16425,14 +16425,14 @@

cardx coverage - 95.35%

89 - 11x + 14x
  if (!inherits(x, "survfitms") && !is.null(type)) {
90 - 1x + 2x
    type <- arg_match(type, values = c("survival", "risk", "cumhaz"))
@@ -16460,7 +16460,7 @@

cardx coverage - 95.35%

94 - 11x + 13x
  if (!is.null(probs) && !is.null(type)) {
@@ -16509,28 +16509,28 @@

cardx coverage - 95.35%

101 - 11x + 13x
  est_type <- ifelse(is.null(probs), "times", "probs")
102 - 11x + 13x
  tidy_survfit <- switch(est_type,
103 - 11x + 13x
    "times" = .process_survfit_time(x, times, type %||% "survival"),
104 - 11x + 13x
    "probs" = .process_survfit_probs(x, probs)
@@ -16551,7 +16551,7 @@

cardx coverage - 95.35%

107 - 11x + 13x
  .format_survfit_results(tidy_survfit)
@@ -17356,63 +17356,63 @@

cardx coverage - 95.35%

222 - 1x + 3x
  df_stat <- map2(
223 - 1x + 3x
    probs,
224 - 1x + 3x
    seq_along(probs),
225 - 1x + 3x
    ~ stats::quantile(x, probs = .x) %>%
226 - 1x + 3x
      as.data.frame() %>%
227 - 1x + 3x
      set_names(c("estimate", "conf.low", "conf.high")) %>%
228 - 1x + 3x
      dplyr::mutate(strata = row.names(.)) %>%
229 - 1x + 3x
      dplyr::select(dplyr::any_of(c("n.risk", "strata", "estimate", "std.error", "conf.low", "conf.high"))) %>%
230 - 1x + 3x
      dplyr::mutate(prob = .x)
@@ -17426,28 +17426,28 @@

cardx coverage - 95.35%

232 - 1x + 3x
    dplyr::bind_rows() %>%
233 - 1x + 3x
    `rownames<-`(NULL) %>%
234 - 1x + 3x
    dplyr::mutate(context = "survival_survfit") %>%
235 - 1x + 3x
    dplyr::as_tibble()
@@ -17459,9 +17459,9 @@

cardx coverage - 95.35%


                     
                   
-                  
+                  
                     237
-                    !
+                    1x
                     
                       
  if (length(x$n) == 1) df_stat <- df_stat %>% dplyr::select(-"strata")
@@ -17475,7 +17475,7 @@

cardx coverage - 95.35%

239 - 1x + 3x
  df_stat <- extract_multi_strata(x, df_stat)
@@ -17489,7 +17489,7 @@

cardx coverage - 95.35%

241 - 1x + 3x
  df_stat
@@ -17524,28 +17524,28 @@

cardx coverage - 95.35%

246 - 11x + 13x
  x_terms <- attr(stats::terms(stats::as.formula(x$call$formula)), "term.labels")
247 - 11x + 13x
  x_terms <- gsub(".*\\(", "", gsub("\\)", "", x_terms))
248 - 11x + 13x
  if (length(x_terms) > 1) {
249 - 3x + 4x
    strata_lvls <- data.frame()
@@ -17559,35 +17559,35 @@

cardx coverage - 95.35%

251 - 3x + 4x
    for (i in df_stat[["strata"]]) {
252 - 42x + 56x
      i <- gsub(".*\\(", "", gsub("\\)", "", i))
253 - 42x + 56x
      terms_str <- strsplit(i, paste(c(paste0(x_terms, "="), paste0(", ", x_terms, "=")), collapse = "|"))[[1]]
254 - 42x + 56x
      s_lvl <- terms_str[nchar(terms_str) > 0]
255 - 42x + 56x
      strata_lvls <- rbind(strata_lvls, s_lvl)
@@ -17601,28 +17601,28 @@

cardx coverage - 95.35%

257 - 3x + 4x
    if (nrow(strata_lvls) > 0) {
258 - 3x + 4x
      strata_lvls <- cbind(strata_lvls, t(x_terms))
259 - 3x + 4x
      names(strata_lvls) <- c(
260 - 3x + 4x
        t(sapply(seq_along(x_terms), function(i) c(paste0("group", i, "_level"), paste0("group", i))))
@@ -17636,14 +17636,14 @@

cardx coverage - 95.35%

262 - 3x + 4x
      df_stat <- cbind(df_stat, strata_lvls) %>%
263 - 3x + 4x
        dplyr::select(-"strata")
@@ -17664,7 +17664,7 @@

cardx coverage - 95.35%

266 - 11x + 13x
  df_stat
@@ -17776,7 +17776,7 @@

cardx coverage - 95.35%

282 - 11x + 13x
  est <- if ("time" %in% names(tidy_survfit)) "time" else "prob"
@@ -17790,21 +17790,21 @@

cardx coverage - 95.35%

284 - 11x + 13x
  ret <- tidy_survfit %>%
285 - 11x + 13x
    dplyr::mutate(dplyr::across(
286 - 11x + 13x
      dplyr::any_of(c("n.risk", "estimate", "std.error", "conf.high", "conf.low", "time", "prob")), ~ as.list(.)
@@ -17818,28 +17818,28 @@

cardx coverage - 95.35%

288 - 11x + 13x
    tidyr::pivot_longer(
289 - 11x + 13x
      cols = dplyr::any_of(c("n.risk", "estimate", "std.error", "conf.high", "conf.low")),
290 - 11x + 13x
      names_to = "stat_name",
291 - 11x + 13x
      values_to = "stat"
@@ -17853,21 +17853,21 @@

cardx coverage - 95.35%

293 - 11x + 13x
    dplyr::mutate(
294 - 11x + 13x
      variable = est,
295 - 11x + 13x
      variable_level = .data[[est]]
@@ -17881,7 +17881,7 @@

cardx coverage - 95.35%

297 - 11x + 13x
    dplyr::select(-all_of(est))
@@ -17895,7 +17895,7 @@

cardx coverage - 95.35%

299 - 11x + 13x
  if ("strata" %in% names(ret)) {
@@ -17930,28 +17930,28 @@

cardx coverage - 95.35%

304 - 11x + 13x
  ret %>%
305 - 11x + 13x
    dplyr::left_join(
306 - 11x + 13x
      .df_survfit_stat_labels(),
307 - 11x + 13x
      by = "stat_name"
@@ -17965,56 +17965,56 @@

cardx coverage - 95.35%

309 - 11x + 13x
    dplyr::mutate(
310 - 11x + 13x
      fmt_fn = lapply(
311 - 11x + 13x
        .data$stat,
312 - 11x + 13x
        function(x) {
313 - 398x + 446x
          switch(is.integer(x),
314 - 398x + 446x
            0L
315 - 398x + 446x
          ) %||% switch(is.numeric(x),
316 - 398x + 446x
            1L
@@ -18042,7 +18042,7 @@

cardx coverage - 95.35%

320 - 11x + 13x
      stat_label = dplyr::coalesce(.data$stat_label, .data$stat_name)
@@ -18056,28 +18056,28 @@

cardx coverage - 95.35%

322 - 11x + 13x
    dplyr::mutate(dplyr::across(matches("group[0-9]*_level"), ~ as.list(as.factor(.x)))) %>%
323 - 11x + 13x
    dplyr::mutate(
324 - 11x + 13x
      warning = list(NULL),
325 - 11x + 13x
      error = list(NULL)
@@ -18091,21 +18091,21 @@

cardx coverage - 95.35%

327 - 11x + 13x
    cards::as_card() %>%
328 - 11x + 13x
    cards::tidy_ard_column_order() %>%
329 - 11x + 13x
    cards::tidy_ard_row_order()
@@ -18133,70 +18133,70 @@

cardx coverage - 95.35%

333 - 11x + 13x
  dplyr::tribble(
334 - 11x + 13x
    ~stat_name, ~stat_label,
335 - 11x + 13x
    "n.risk", "Number of Subjects at Risk",
336 - 11x + 13x
    "estimate", "Survival Probability",
337 - 11x + 13x
    "std.error", "Standard Error (untransformed)",
338 - 11x + 13x
    "conf.low", "CI Lower Bound",
339 - 11x + 13x
    "conf.high", "CI Upper Bound",
340 - 11x + 13x
    "conf.level", "CI Confidence Level",
341 - 11x + 13x
    "prob", "Quantile",
342 - 11x + 13x
    "time", "Time"
@@ -21378,14 +21378,14 @@

cardx coverage - 95.35%

22 - 18x + 19x
  check_not_missing(data)
23 - 18x + 19x
  UseMethod("ard_continuous_ci")
@@ -21909,7 +21909,7 @@

cardx coverage - 95.35%

35 - 15x + 16x
  set_cli_abort_call()
@@ -21930,21 +21930,21 @@

cardx coverage - 95.35%

38 - 15x + 16x
  check_not_missing(data)
39 - 15x + 16x
  check_class(data, "survey.design")
40 - 15x + 16x
  check_not_missing(variables)
@@ -21958,28 +21958,28 @@

cardx coverage - 95.35%

42 - 15x + 16x
  cards::process_selectors(
43 - 15x + 16x
    data = data$variables,
44 - 15x + 16x
    variables = {{ variables }},
45 - 15x + 16x
    by = {{ by }}
@@ -21993,21 +21993,21 @@

cardx coverage - 95.35%

47 - 15x + 16x
  check_scalar(by, allow_empty = TRUE)
48 - 15x + 16x
  check_scalar_range(conf.level, range = c(0, 1))
49 - 15x + 16x
  method <- arg_match(method)
@@ -22021,42 +22021,42 @@

cardx coverage - 95.35%

51 - 15x + 16x
  walk(
52 - 15x + 16x
    variables,
53 - 15x + 16x
    \(variable) {
54 - 26x + 27x
      if (!is.numeric(data$variables[[variable]])) {
- + 55 - ! + 1x
        cli::cli_inform(
- + 56 - ! + 1x
          "Column {.val {variable}} is not {.cls numeric} and results may be an unexpected format."
@@ -22105,7 +22105,7 @@

cardx coverage - 95.35%

63 - 15x + 16x
  if (is_empty(variables)) {
@@ -22140,56 +22140,56 @@

cardx coverage - 95.35%

68 - 14x + 15x
  .calculate_ard_continuous_survey_ci(
69 - 14x + 15x
    FUN = ifelse(method == "svymean", .svymean_confint_wrapper, .svyquantile_confint_wrapper),
70 - 14x + 15x
    data = data,
71 - 14x + 15x
    variables = variables,
72 - 14x + 15x
    by = by,
73 - 14x + 15x
    conf.level = conf.level,
74 - 14x + 15x
    method = method,
75 - 14x + 15x
    df = df,
@@ -22238,63 +22238,63 @@

cardx coverage - 95.35%

82 - 14x + 15x
  map(
83 - 14x + 15x
    variables,
84 - 14x + 15x
    function(variable) {
85 - 26x + 27x
      .calculate_one_ard_continuous_survey_ci(
86 - 26x + 27x
        FUN = FUN,
87 - 26x + 27x
        data = data,
88 - 26x + 27x
        variable = variable,
89 - 26x + 27x
        by = by,
90 - 26x + 27x
        conf.level = conf.level,
@@ -22329,7 +22329,7 @@

cardx coverage - 95.35%

95 - 14x + 15x
    dplyr::bind_rows()
@@ -22357,7 +22357,7 @@

cardx coverage - 95.35%

99 - 26x + 27x
  if (!is_empty(by)) {
@@ -22427,35 +22427,35 @@

cardx coverage - 95.35%

109 - 26x + 27x
  df_full <-
110 - 26x + 27x
    case_switch(
111 - 26x + 27x
      !is_empty(by) ~
112 - 26x + 27x
        tidyr::expand_grid(
113 - 26x + 27x
          group1_level = as.character(by_levels) |> as.list()
@@ -22469,21 +22469,21 @@

cardx coverage - 95.35%

115 - 26x + 27x
        dplyr::mutate(group1 = .env$by, variable = .env$variable),
116 - 26x + 27x
      .default =
117 - 26x + 27x
        dplyr::tibble(variable = .env$variable)
@@ -22497,56 +22497,56 @@

cardx coverage - 95.35%

119 - 26x + 27x
    dplyr::rowwise() |>
120 - 26x + 27x
    dplyr::mutate(
121 - 26x + 27x
      lst_result =
122 - 26x + 27x
        FUN(
123 - 26x + 27x
          data =
124 - 26x + 27x
            case_switch(
125 - 26x + 27x
              is_empty(.env$by) ~ data,
126 - 26x + 27x
              .default = lst_data[[.data$group1_level]]
@@ -22560,14 +22560,14 @@

cardx coverage - 95.35%

128 - 26x + 27x
          variable = .data$variable,
129 - 26x + 27x
          conf.level = .env$conf.level,
@@ -22588,56 +22588,56 @@

cardx coverage - 95.35%

132 - 26x + 27x
          list(),
133 - 26x + 27x
      result =
134 - 26x + 27x
        .data$lst_result[["result"]] |>
135 - 26x + 27x
          enframe("stat_name", "stat") |>
136 - 26x + 27x
          list(),
137 - 26x + 27x
      warning = .data$lst_result["warning"] |> unname(),
138 - 26x + 27x
      error = .data$lst_result["error"] |> unname(),
139 - 26x + 27x
      context = "survey_continuous_ci"
@@ -22651,42 +22651,42 @@

cardx coverage - 95.35%

141 - 26x + 27x
    dplyr::select(-"lst_result") |>
142 - 26x + 27x
    dplyr::ungroup() |>
143 - 26x + 27x
    tidyr::unnest("result") |>
144 - 26x + 27x
    dplyr::mutate(
145 - 26x + 27x
      stat_label = .data$stat_name,
146 - 26x + 27x
      fmt_fn = map(.data$stat, ~ case_switch(is.numeric(.x) ~ 2L, .default = as.character))
@@ -22700,14 +22700,14 @@

cardx coverage - 95.35%

148 - 26x + 27x
    cards::as_card() |>
149 - 26x + 27x
    cards::tidy_ard_column_order()
@@ -22945,42 +22945,42 @@

cardx coverage - 95.35%

183 - 8x + 9x
  lst_results <-
184 - 8x + 9x
    cards::eval_capture_conditions({
185 - 8x + 9x
      svyquantile <-
186 - 8x + 9x
        survey::svyquantile(
187 - 8x + 9x
          x = reformulate2(variable), design = data, quantiles = 0.5,
188 - 8x + 9x
          na.rm = TRUE, interval.type = str_remove(method, pattern = "^svymedian\\.")
@@ -23113,14 +23113,14 @@

cardx coverage - 95.35%

207 - 8x + 9x
  if (is_empty(lst_results[["result"]])) {
- + 208 - ! + 1x
    lst_results[["result"]] <- rep_named(c("estimate", "std.error", "conf.low", "conf.high"), list(NULL))
@@ -23148,7 +23148,7 @@

cardx coverage - 95.35%

212 - 8x + 9x
  lst_results[["result"]] <- lst_results[["result"]] |> append(list(conf.level = conf.level))
@@ -23169,7 +23169,7 @@

cardx coverage - 95.35%

215 - 8x + 9x
  lst_results
@@ -28379,7 +28379,7 @@

cardx coverage - 95.35%

29 - 3x + 5x
  set_cli_abort_call()
@@ -28400,7 +28400,7 @@

cardx coverage - 95.35%

32 - 3x + 5x
  check_pkg_installed("broom", reference_pkg = "cardx")
@@ -28421,49 +28421,49 @@

cardx coverage - 95.35%

35 - 3x + 5x
  check_not_missing(data)
36 - 3x + 5x
  check_not_missing(variables)
37 - 3x + 5x
  check_not_missing(by)
38 - 3x + 5x
  check_data_frame(data)
39 - 3x + 5x
  data <- dplyr::ungroup(data)
40 - 3x + 5x
  cards::process_selectors(data, by = {{ by }}, variables = {{ variables }})
41 - 3x + 5x
  check_scalar(by)
@@ -28484,7 +28484,7 @@

cardx coverage - 95.35%

44 - 3x + 5x
  if (is_empty(variables)) {
@@ -28519,70 +28519,70 @@

cardx coverage - 95.35%

49 - 3x + 5x
  lapply(
50 - 3x + 5x
    variables,
51 - 3x + 5x
    function(variable) {
52 - 3x + 6x
      .format_moodtest_results(
53 - 3x + 6x
        by = by,
54 - 3x + 6x
        variable = variable,
55 - 3x + 6x
        lst_tidy =
56 - 3x + 6x
          cards::eval_capture_conditions(
57 - 3x + 6x
            stats::mood.test(data[[variable]] ~ data[[by]], ...) |>
58 - 3x + 6x
              broom::tidy()
@@ -28624,7 +28624,7 @@

cardx coverage - 95.35%

64 - 3x + 5x
    dplyr::bind_rows()
@@ -28792,49 +28792,49 @@

cardx coverage - 95.35%

88 - 3x + 6x
  ret <-
89 - 3x + 6x
    cards::tidy_as_ard(
90 - 3x + 6x
      lst_tidy = lst_tidy,
91 - 3x + 6x
      tidy_result_names = c("statistic", "p.value", "method", "alternative"),
92 - 3x + 6x
      formals = formals(asNamespace("stats")[["mood.test.default"]]),
93 - 3x + 6x
      passed_args = c(dots_list(...)),
94 - 3x + 6x
      lst_ard_columns = list(group1 = by, variable = variable, context = "stats_mood_test")
@@ -28862,28 +28862,28 @@

cardx coverage - 95.35%

98 - 3x + 6x
  ret |>
99 - 3x + 6x
    dplyr::left_join(
100 - 3x + 6x
      .df_moodtest_stat_labels(),
101 - 3x + 6x
      by = "stat_name"
@@ -28897,21 +28897,21 @@

cardx coverage - 95.35%

103 - 3x + 6x
    dplyr::mutate(stat_label = dplyr::coalesce(.data$stat_label, .data$stat_name)) |>
104 - 3x + 6x
    cards::as_card() |>
105 - 3x + 6x
    cards::tidy_ard_column_order()
@@ -28939,35 +28939,35 @@

cardx coverage - 95.35%

109 - 3x + 6x
  dplyr::tribble(
110 - 3x + 6x
    ~stat_name, ~stat_label,
111 - 3x + 6x
    "statistic", "Z-Statistic",
112 - 3x + 6x
    "p.value", "p-value",
113 - 3x + 6x
    "alternative", "Alternative Hypothesis"
@@ -29141,7 +29141,7 @@

cardx coverage - 95.35%

22 - 11x + 18x
  UseMethod("ard_regression")
@@ -29183,7 +29183,7 @@

cardx coverage - 95.35%

28 - 11x + 18x
  set_cli_abort_call()
@@ -29204,7 +29204,7 @@

cardx coverage - 95.35%

31 - 11x + 18x
  check_pkg_installed(pkg = "broom.helpers", reference_pkg = "cardx")
@@ -29225,7 +29225,7 @@

cardx coverage - 95.35%

34 - 11x + 18x
  check_not_missing(x)
@@ -29246,28 +29246,28 @@

cardx coverage - 95.35%

37 - 11x + 18x
  lst_results <- cards::eval_capture_conditions(
38 - 11x + 18x
    broom.helpers::tidy_plus_plus(
39 - 11x + 18x
      model = x,
40 - 11x + 18x
      tidy_fun = tidy_fun,
@@ -29309,7 +29309,7 @@

cardx coverage - 95.35%

46 - 11x + 18x
  .regression_final_ard_prep(lst_results)
@@ -29344,42 +29344,42 @@

cardx coverage - 95.35%

51 - 11x + 18x
  df_card <-
52 - 11x + 18x
    if (!is.null(lst_results[["result"]])) {
53 - 10x + 16x
      lst_results[["result"]] |>
54 - 10x + 16x
        dplyr::mutate(
55 - 10x + 16x
          variable_level = as.list(dplyr::if_else(.data$var_type %in% "continuous", NA_character_, .data$label)),
56 - 10x + 16x
          dplyr::across(-c("variable", "variable_level"), .fns = as.list)
@@ -29393,28 +29393,28 @@

cardx coverage - 95.35%

58 - 10x + 16x
        tidyr::pivot_longer(
59 - 10x + 16x
          cols = -c("variable", "variable_level"),
60 - 10x + 16x
          names_to = "stat_name",
61 - 10x + 16x
          values_to = "stat"
@@ -29428,49 +29428,49 @@

cardx coverage - 95.35%

63 - 10x + 16x
        dplyr::filter(map_lgl(.data$stat, Negate(is.na))) |>
64 - 10x + 16x
        dplyr::select(-(cards::all_ard_variables("levels") & dplyr::where(\(x) all(is.na(x)))))
65 - 11x + 18x
    } else { # if there was an error return a shell of an ARD data frame
66 - 1x + 2x
      dplyr::tibble(
67 - 1x + 2x
        variable = "model_1",
68 - 1x + 2x
        stat_name = "estimate",
69 - 1x + 2x
        stat = list(NULL)
@@ -29505,77 +29505,77 @@

cardx coverage - 95.35%

74 - 11x + 18x
  df_card |>
75 - 11x + 18x
    dplyr::mutate(
76 - 11x + 18x
      warning = lst_results["warning"],
77 - 11x + 18x
      error = lst_results["error"],
78 - 11x + 18x
      fmt_fn = lapply(
79 - 11x + 18x
        .data$stat,
80 - 11x + 18x
        function(x) {
81 - 295x + 429x
          switch(is.integer(x),
82 - 295x + 429x
            0L
83 - 295x + 429x
          ) %||% switch(is.numeric(x),
84 - 295x + 429x
            1L
@@ -29603,7 +29603,7 @@

cardx coverage - 95.35%

88 - 11x + 18x
      context = "regression"
@@ -29617,21 +29617,21 @@

cardx coverage - 95.35%

90 - 11x + 18x
    dplyr::left_join(
91 - 11x + 18x
      .df_regression_stat_labels(),
92 - 11x + 18x
      by = "stat_name"
@@ -29645,21 +29645,21 @@

cardx coverage - 95.35%

94 - 11x + 18x
    dplyr::mutate(stat_label = dplyr::coalesce(.data$stat_label, .data$stat_name)) |>
95 - 11x + 18x
    cards::as_card() |>
96 - 11x + 18x
    cards::tidy_ard_column_order()
@@ -29687,112 +29687,112 @@

cardx coverage - 95.35%

100 - 11x + 18x
  dplyr::tribble(
101 - 11x + 18x
    ~stat_name, ~stat_label,
102 - 11x + 18x
    "var_label", "Label",
103 - 11x + 18x
    "var_class", "Class",
104 - 11x + 18x
    "var_type", "Type",
105 - 11x + 18x
    "var_nlevels", "N Levels",
106 - 11x + 18x
    "contrasts_type", "Contrast Type",
107 - 11x + 18x
    "label", "Level Label",
108 - 11x + 18x
    "n_obs", "N Obs.",
109 - 11x + 18x
    "n_event", "N Events",
110 - 11x + 18x
    "exposure", "Exposure Time",
111 - 11x + 18x
    "estimate", "Coefficient",
112 - 11x + 18x
    "std.error", "Standard Error",
113 - 11x + 18x
    "p.value", "p-value",
114 - 11x + 18x
    "conf.low", "CI Lower Bound",
115 - 11x + 18x
    "conf.high", "CI Upper Bound",
@@ -30078,7 +30078,7 @@

cardx coverage - 95.35%

38 - 5x + 6x
  set_cli_abort_call()
@@ -30099,7 +30099,7 @@

cardx coverage - 95.35%

41 - 5x + 6x
  check_pkg_installed(pkg = "broom.helpers", reference_pkg = "cardx")
@@ -30120,14 +30120,14 @@

cardx coverage - 95.35%

44 - 5x + 6x
  check_not_missing(x)
45 - 5x + 6x
  check_class(stats_to_remove, cls = "character", allow_empty = TRUE)
@@ -30148,42 +30148,42 @@

cardx coverage - 95.35%

48 - 5x + 6x
  args <-
49 - 5x + 6x
    list(
50 - 5x + 6x
      add_reference_rows = FALSE,
51 - 5x + 6x
      add_estimate_to_reference_rows = FALSE,
52 - 5x + 6x
      add_n = FALSE,
53 - 5x + 6x
      intercept = FALSE
@@ -30197,7 +30197,7 @@

cardx coverage - 95.35%

55 - 5x + 6x
    utils::modifyList(val = rlang::dots_list(...))
@@ -30211,21 +30211,21 @@

cardx coverage - 95.35%

57 - 5x + 6x
  rlang::inject(ard_regression(x = x, tidy_fun = tidy_fun, !!!args)) |>
58 - 5x + 6x
    dplyr::filter(!.data$stat_name %in% stats_to_remove) |>
59 - 5x + 6x
    dplyr::select(-(cards::all_ard_variables("levels") & dplyr::where(\(x) all(is.na(x)))))
@@ -31637,21 +31637,21 @@

cardx coverage - 95.35%

33 - 16x + 18x
  set_cli_abort_call()
34 - 16x + 18x
  check_dots_empty()
35 - 16x + 18x
  check_pkg_installed(pkg = "survey", reference_pkg = "cardx")
@@ -31672,7 +31672,7 @@

cardx coverage - 95.35%

38 - 16x + 18x
  check_not_missing(variables)
@@ -31693,35 +31693,35 @@

cardx coverage - 95.35%

41 - 16x + 18x
  cards::process_selectors(data$variables, variables = {{ variables }})
42 - 16x + 18x
  cards::process_formula_selectors(data$variables[variables], value = value)
43 - 16x + 18x
  cards::fill_formula_selectors(
44 - 16x + 18x
    data$variables[variables],
45 - 16x + 18x
    value = formals(asNamespace("cardx")[["ard_dichotomous.survey.design"]])[["value"]] |> eval()
@@ -31735,7 +31735,7 @@

cardx coverage - 95.35%

47 - 16x + 18x
  .check_dichotomous_value(data$variables, value)
@@ -32043,70 +32043,70 @@

cardx coverage - 95.35%

91 - 16x + 18x
  imap(
92 - 16x + 18x
    value,
93 - 16x + 18x
    function(value, column) {
94 - 29x + 32x
      accepted_values <- .unique_and_sorted(data[[column]])
95 - 29x + 32x
      if (length(value) != 1L || !value %in% accepted_values) {
96 - 1x + 3x
        message <- "Error in argument {.arg value} for variable {.val {column}}."
97 - 1x + 3x
        message <-
98 - 1x + 3x
          case_switch(
99 - 1x + 3x
            length(value) != 1L ~ c(message, "i" = "The value must be one of {.val {accepted_values}}."),
100 - 1x + 3x
            .default = c(message, "i" = "A value of {.val {value}} was passed, but must be one of {.val {accepted_values}}.")
@@ -32120,42 +32120,42 @@

cardx coverage - 95.35%

102 - 1x + 3x
        if (length(value) == 1L) {
103 - 1x + 3x
          message <-
104 - 1x + 3x
            case_switch(
105 - 1x + 3x
              inherits(data[[column]], "factor") ~
106 - 1x + 3x
                c(message, i = "To summarize this value, use {.fun forcats::fct_expand} to add {.val {value}} as a level."),
107 - 1x + 3x
              .default = c(message, i = "To summarize this value, make the column a factor and include {.val {value}} as a level.")
@@ -32190,21 +32190,21 @@

cardx coverage - 95.35%

112 - 1x + 3x
        cli::cli_abort(
113 - 1x + 3x
          message = message,
114 - 1x + 3x
          call = get_cli_abort_call()
@@ -32239,7 +32239,7 @@

cardx coverage - 95.35%

119 - 16x + 18x
    invisible()
@@ -32407,7 +32407,7 @@

cardx coverage - 95.35%

143 - 314x + 317x
  useNA <- match.arg(useNA)
@@ -32421,42 +32421,42 @@

cardx coverage - 95.35%

145 - 314x + 317x
  if (inherits(x, "factor")) {
146 - 241x + 243x
    return(
147 - 241x + 243x
      factor(
148 - 241x + 243x
        if (useNA == "no") levels(x)
149 - 241x + 243x
        else c(levels(x), NA_character_),
150 - 241x + 243x
        levels = levels(x)
@@ -32484,7 +32484,7 @@

cardx coverage - 95.35%

154 - 73x + 74x
  if (inherits(x, "logical")) {
@@ -32526,7 +32526,7 @@

cardx coverage - 95.35%

160 - 24x + 25x
  if (useNA == "no") return(unique(x) |> sort())
@@ -32700,7 +32700,7 @@

cardx coverage - 95.35%

21 - 4x + 5x
  set_cli_abort_call()
@@ -32721,7 +32721,7 @@

cardx coverage - 95.35%

24 - 4x + 5x
  check_pkg_installed("car", reference_pkg = "cardx")
@@ -32742,7 +32742,7 @@

cardx coverage - 95.35%

27 - 4x + 5x
  check_not_missing(x)
@@ -32756,7 +32756,7 @@

cardx coverage - 95.35%

29 - 4x + 5x
  vif <- cards::eval_capture_conditions(car::vif(x, ...))
@@ -32777,7 +32777,7 @@

cardx coverage - 95.35%

32 - 4x + 5x
  if (is.null(vif$result)) {
@@ -32910,14 +32910,14 @@

cardx coverage - 95.35%

51 - 2x + 3x
  else if (!is.matrix(vif$result)) {
- + 52 - ! + 1x
    vif$result <- dplyr::tibble(variable = names(vif$result), VIF = vif$result)
@@ -33029,42 +33029,42 @@

cardx coverage - 95.35%

68 - 3x + 4x
  vif$result <-
69 - 3x + 4x
    vif$result |>
70 - 3x + 4x
    tidyr::pivot_longer(
71 - 3x + 4x
      cols = -c("variable"),
72 - 3x + 4x
      names_to = "stat_name",
73 - 3x + 4x
      values_to = "stat"
@@ -33078,49 +33078,49 @@

cardx coverage - 95.35%

75 - 3x + 4x
    dplyr::mutate(
76 - 3x + 4x
      context = "car_vif",
77 - 3x + 4x
      stat = as.list(.data$stat),
78 - 3x + 4x
      stat_label = ifelse(
79 - 3x + 4x
        .data$stat_name == "aGVIF",
80 - 3x + 4x
        "Adjusted GVIF",
81 - 3x + 4x
        .data$stat_name
@@ -33134,21 +33134,21 @@

cardx coverage - 95.35%

83 - 3x + 4x
      fmt_fn = map(
84 - 3x + 4x
        .data$stat,
85 - 3x + 4x
        function(.x) {
@@ -33169,7 +33169,7 @@

cardx coverage - 95.35%

88 - 12x + 14x
          if (is.numeric(.x)) return(1L)
@@ -33225,28 +33225,28 @@

cardx coverage - 95.35%

96 - 3x + 4x
  vif_return <- dplyr::tibble(
97 - 3x + 4x
    vif$result,
98 - 3x + 4x
    warning = vif["warning"],
99 - 3x + 4x
    error = vif["error"]
@@ -33274,21 +33274,21 @@

cardx coverage - 95.35%

103 - 3x + 4x
  vif_return |>
104 - 3x + 4x
    cards::as_card() |>
105 - 3x + 4x
    cards::tidy_ard_column_order()
@@ -38714,7 +38714,7 @@

cardx coverage - 95.35%

191 - 718x + 729x
  dots <- dots_list(...)
@@ -38728,21 +38728,21 @@

cardx coverage - 95.35%

193 - 718x + 729x
  for (f in dots) {
194 - 945x + 956x
    if (isTRUE(eval(f_lhs(f), envir = attr(f, ".Environment")))) {
195 - 581x + 584x
      return(eval(f_rhs(f), envir = attr(f, ".Environment")))
@@ -38770,7 +38770,7 @@

cardx coverage - 95.35%

199 - 137x + 145x
  return(.default)
@@ -39811,7 +39811,7 @@

cardx coverage - 95.35%

22 - 3x + 5x
  set_cli_abort_call()
@@ -39832,28 +39832,28 @@

cardx coverage - 95.35%

25 - 3x + 5x
  check_pkg_installed(c("survival", "broom"), reference_pkg = "cardx")
26 - 3x + 5x
  check_not_missing(x)
27 - 3x + 5x
  check_not_missing(times)
28 - 3x + 5x
  check_class(x, "survfit")
@@ -39867,28 +39867,28 @@

cardx coverage - 95.35%

30 - 3x + 5x
  if (inherits(x, c("survfitms", "survfitcox"))) {
- + 31 - ! + 1x
    cli::cli_abort(
- + 32 - ! + 1x
      "Argument {.arg x} cannot be class {.cls {c('survfitms', 'survfitcox')}}.",
- + 33 - ! + 1x
      call = get_cli_abort_call()
@@ -39909,35 +39909,35 @@

cardx coverage - 95.35%

36 - 3x + 4x
  check_scalar_range(conf.level, range = c(0, 1))
37 - 3x + 4x
  check_length(
38 - 3x + 4x
    as.list(x$call)[["formula"]] |> stats::as.formula() |> stats::terms() |> attr("term.labels"),
39 - 3x + 4x
    length = 1L,
40 - 3x + 4x
    message = "The {.cls survfit} object passed in argument {.arg x} must be stratified by a single variable."
@@ -39951,28 +39951,28 @@

cardx coverage - 95.35%

42 - 2x + 3x
  if (length(x$strata) < 2) {
- + 43 - ! + 1x
    cli::cli_abort(
- + 44 - ! + 1x
      "The {.cls survfit} object's stratifying variable must have 2 or more levels.",
- + 45 - ! + 1x
      call = get_cli_abort_call()
@@ -41663,14 +41663,14 @@

cardx coverage - 95.35%

18 - 2x + 3x
  set_cli_abort_call()
19 - 2x + 3x
  check_pkg_installed("broom.helpers", reference_pkg = "cardx")
@@ -41691,7 +41691,7 @@

cardx coverage - 95.35%

22 - 2x + 3x
  check_pkg_installed("aod", reference_pkg = "cardx")
@@ -41712,7 +41712,7 @@

cardx coverage - 95.35%

25 - 2x + 3x
  check_not_missing(x)
@@ -41733,49 +41733,49 @@

cardx coverage - 95.35%

28 - 2x + 3x
  reg_model <- cards::eval_capture_conditions(
29 - 2x + 3x
    ard_regression_basic(x, tidy_fun = tidy_fun, intercept = TRUE, stats_to_remove = c(
30 - 2x + 3x
      "var_type",
31 - 2x + 3x
      "var_label",
32 - 2x + 3x
      "var_class", "label",
33 - 2x + 3x
      "contrasts_type", "contrasts", "var_nlevels", "std.error",
34 - 2x + 3x
      "conf.low", "conf.high", "statistic", "p.value", "estimate"
@@ -41803,7 +41803,7 @@

cardx coverage - 95.35%

38 - 2x + 3x
  if (!is.null(reg_model[["error"]])) {
@@ -41859,35 +41859,35 @@

cardx coverage - 95.35%

46 - 2x + 3x
  aod <-
47 - 2x + 3x
    reg_model[["result"]] %>%
48 - 2x + 3x
    dplyr::select(c(
49 - 2x + 3x
      variable = "variable",
50 - 2x + 3x
      model_terms = "stat"
@@ -41901,42 +41901,42 @@

cardx coverage - 95.35%

52 - 2x + 3x
    dplyr::mutate(term_id = dplyr::row_number()) %>%
53 - 2x + 3x
    tidyr::nest(data = -"variable") %>%
54 - 2x + 3x
    dplyr::rowwise() %>%
55 - 2x + 3x
    dplyr::mutate(
56 - 2x + 3x
      model_terms = unlist(.data$data[["model_terms"]]) %>% list(),
57 - 2x + 3x
      model_terms_id = rlang::set_names(.data$data[["term_id"]]) %>% list()
@@ -44166,7 +44166,7 @@

cardx coverage - 95.35%

23 - 3x + 5x
  set_cli_abort_call()
@@ -44187,7 +44187,7 @@

cardx coverage - 95.35%

26 - 3x + 5x
  check_pkg_installed("broom", reference_pkg = "cardx")
@@ -44208,42 +44208,42 @@

cardx coverage - 95.35%

29 - 3x + 5x
  check_not_missing(data)
30 - 3x + 5x
  check_not_missing(variables)
31 - 3x + 5x
  check_not_missing(by)
32 - 3x + 5x
  check_data_frame(data)
33 - 3x + 5x
  cards::process_selectors(data, by = {{ by }}, variables = {{ variables }})
34 - 3x + 5x
  check_scalar(by)
@@ -44264,7 +44264,7 @@

cardx coverage - 95.35%

37 - 3x + 5x
  if (is_empty(variables)) {
@@ -44299,56 +44299,56 @@

cardx coverage - 95.35%

42 - 3x + 5x
  lapply(
43 - 3x + 5x
    variables,
44 - 3x + 5x
    function(variable) {
45 - 3x + 6x
      cards::tidy_as_ard(
46 - 3x + 6x
        lst_tidy =
47 - 3x + 6x
          cards::eval_capture_conditions(
48 - 3x + 6x
            stats::kruskal.test(x = data[[variable]], g = data[[by]]) |>
49 - 3x + 6x
              broom::tidy()
@@ -44362,14 +44362,14 @@

cardx coverage - 95.35%

51 - 3x + 6x
        tidy_result_names = c("statistic", "p.value", "parameter", "method"),
52 - 3x + 6x
        lst_ard_columns = list(group1 = by, variable = variable, context = "stats_kruskal_test")
@@ -44383,56 +44383,56 @@

cardx coverage - 95.35%

54 - 3x + 6x
        dplyr::mutate(
55 - 3x + 6x
          .after = "stat_name",
56 - 3x + 6x
          stat_label =
57 - 3x + 6x
            dplyr::case_when(
58 - 3x + 6x
              .data$stat_name %in% "statistic" ~ "Kruskal-Wallis chi-squared Statistic",
59 - 3x + 6x
              .data$stat_name %in% "p.value" ~ "p-value",
60 - 3x + 6x
              .data$stat_name %in% "parameter" ~ "Degrees of Freedom",
61 - 3x + 6x
              TRUE ~ .data$stat_name,
@@ -44467,14 +44467,14 @@

cardx coverage - 95.35%

66 - 3x + 5x
    dplyr::bind_rows() |>
67 - 3x + 5x
    cards::as_card()