From d45a72ad28f4b3dbdf7fb408a32d6b8f005482c4 Mon Sep 17 00:00:00 2001 From: Demetri Pananos Date: Fri, 16 Aug 2024 05:40:29 -0400 Subject: [PATCH] Edits so checks can pass --- R/bootci.R | 3 +- tests/testthat/_snaps/bootci.md | 8 +++--- tests/testthat/_snaps/bootci.new.md | 44 +++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 tests/testthat/_snaps/bootci.new.md diff --git a/R/bootci.R b/R/bootci.R index 510ff44f..e47d3497 100644 --- a/R/bootci.R +++ b/R/bootci.R @@ -128,7 +128,8 @@ check_num_resamples <- function(x, B = 1000) { dplyr::filter(n < B) if (nrow(x) > 0) { - cli::cli_warn("Recommend at least {B} non-missing bootstrap resamples for {x$terms} term{?s}.") + terms <- paste0("`", x$term, "`") + cli::cli_warn("Recommend at least {B} non-missing bootstrap resamples for {cli::qty(terms)} term{?s} {terms}.") } invisible(NULL) } diff --git a/tests/testthat/_snaps/bootci.md b/tests/testthat/_snaps/bootci.md index d3106318..77e607e1 100644 --- a/tests/testthat/_snaps/bootci.md +++ b/tests/testthat/_snaps/bootci.md @@ -4,9 +4,9 @@ int_pctl(bt_resamples, res) Condition Warning: - Recommend at least 1000 non-missing bootstrap resamples for `mean` term. + Recommend at least 1000 non-missing bootstrap resamples for term `mean`. Error in `pctl_single()`: - ! All statistics have missing values. + ! All statistics have missing values.. --- @@ -14,7 +14,7 @@ int_t(bt_resamples, res) Condition Warning: - Recommend at least 500 non-missing bootstrap resamples for `mean` term. + Recommend at least 500 non-missing bootstrap resamples for term `mean`. Error in `t_single()`: ! All statistics have missing values. @@ -24,7 +24,7 @@ int_bca(bt_resamples, res, .fn = bad_stats) Condition Warning: - Recommend at least 1000 non-missing bootstrap resamples for `mean` term. + Recommend at least 1000 non-missing bootstrap resamples for term `mean`. Error in `bca_calc()`: ! All statistics have missing values. diff --git a/tests/testthat/_snaps/bootci.new.md b/tests/testthat/_snaps/bootci.new.md new file mode 100644 index 00000000..8632d77e --- /dev/null +++ b/tests/testthat/_snaps/bootci.new.md @@ -0,0 +1,44 @@ +# Upper & lower confidence interval does not contain NA + + Code + int_pctl(bt_resamples, res) + Condition + Warning: + Recommend at least 1000 non-missing bootstrap resamples for term `mean`. + Error in `pctl_single()`: + ! All statistics have missing values. + +--- + + Code + int_t(bt_resamples, res) + Condition + Warning: + Recommend at least 500 non-missing bootstrap resamples for term `mean`. + Error in `t_single()`: + ! All statistics have missing values. + +--- + + Code + int_bca(bt_resamples, res, .fn = bad_stats) + Condition + Warning: + Recommend at least 1000 non-missing bootstrap resamples for term `mean`. + Error in `bca_calc()`: + ! All statistics have missing values. + +# regression intervals + + Code + skip_if(new_rng_snapshots) + set.seed(123) + int_2 <- reg_intervals(mpg ~ disp + wt, data = mtcars, filter = term == "wt", + model_fn = "glm", keep_reps = TRUE) + int_2 + Output + # A tibble: 1 x 7 + term .lower .estimate .upper .alpha .method .replicates + > + 1 wt -5.62 -3.46 -0.955 0.05 student-t [1,001 x 2] +