From 58d6440fd6a53723090eafb88ad616d3bfeae7a2 Mon Sep 17 00:00:00 2001 From: Emily de la Rua Date: Wed, 28 Aug 2024 16:14:39 -0400 Subject: [PATCH] Fix checks --- R/boot_ci.R | 3 +-- man/boot_ci.Rd | 2 +- tests/testthat/_snaps/boot_ci.md | 16 ++++++++-------- tests/testthat/test-boot_ci.R | 3 ++- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/R/boot_ci.R b/R/boot_ci.R index bca6d651..74cbbc03 100644 --- a/R/boot_ci.R +++ b/R/boot_ci.R @@ -12,7 +12,7 @@ #' should be any subset of the values `c("norm","basic", "stud", "perc", "bca")` or simply `"all"` which will #' compute all five types of intervals. #' @param stype (`string`)\cr a character string indicating what the second argument of statistic represents. -#' Possible values of stype are `"i"` (indices - the default), `"f"` (frequencies), or `"w"` (weights). +#' Possible values of `stype` are `"i"` (indices - the default), `"f"` (frequencies), or `"w"` (weights). #' @param statistic (`function`)\cr a function which, when applied to data, returns a vector containing the #' statistic(s) of interest. See the parameter description in [boot::boot()] for details. #' @@ -66,7 +66,6 @@ boot_ci <- function(x, paste0("All values of t are equal to ", boot$t0, ". Cannot calculate confidence intervals."), call = get_cli_abort_call() ) - } else { boot.ci <- boot::boot.ci(boot, conf = conf.level, type = type) diff --git a/man/boot_ci.Rd b/man/boot_ci.Rd index f75a8e37..6b828832 100644 --- a/man/boot_ci.Rd +++ b/man/boot_ci.Rd @@ -27,7 +27,7 @@ should be any subset of the values \code{c("norm","basic", "stud", "perc", "bca" compute all five types of intervals.} \item{stype}{(\code{string})\cr a character string indicating what the second argument of statistic represents. -Possible values of stype are \code{"i"} (indices - the default), \code{"f"} (frequencies), or \code{"w"} (weights).} +Possible values of \code{stype} are \code{"i"} (indices - the default), \code{"f"} (frequencies), or \code{"w"} (weights).} \item{statistic}{(\code{function})\cr a function which, when applied to data, returns a vector containing the statistic(s) of interest. See the parameter description in \code{\link[boot:boot]{boot::boot()}} for details.} diff --git a/tests/testthat/_snaps/boot_ci.md b/tests/testthat/_snaps/boot_ci.md index 981a9ac7..e6544886 100644 --- a/tests/testthat/_snaps/boot_ci.md +++ b/tests/testthat/_snaps/boot_ci.md @@ -38,17 +38,17 @@ 3 AGE continuo… conf.level conf.lev… 0.95 bootstra… 4 AGE continuo… R R 2000 bootstra… 5 AGE continuo… ci.type.1 ci.type.1 normal bootstra… - 6 AGE continuo… conf.low.1 conf.low… 74.074 bootstra… - 7 AGE continuo… conf.high.1 conf.hig… 76.094 bootstra… + 6 AGE continuo… conf.low.1 conf.low… 74.081 bootstra… + 7 AGE continuo… conf.high.1 conf.hig… 76.11 bootstra… 8 AGE continuo… ci.type.2 ci.type.2 basic bootstra… - 9 AGE continuo… conf.low.2 conf.low… 74.091 bootstra… - 10 AGE continuo… conf.high.2 conf.hig… 76.063 bootstra… + 9 AGE continuo… conf.low.2 conf.low… 74.114 bootstra… + 10 AGE continuo… conf.high.2 conf.hig… 76.153 bootstra… 11 AGE continuo… ci.type.3 ci.type.3 percent bootstra… - 12 AGE continuo… conf.low.3 conf.low… 74.11 bootstra… - 13 AGE continuo… conf.high.3 conf.hig… 76.083 bootstra… + 12 AGE continuo… conf.low.3 conf.low… 74.02 bootstra… + 13 AGE continuo… conf.high.3 conf.hig… 76.059 bootstra… 14 AGE continuo… ci.type.4 ci.type.4 bca bootstra… - 15 AGE continuo… conf.low.4 conf.low… 74.076 bootstra… - 16 AGE continuo… conf.high.4 conf.hig… 76.075 bootstra… + 15 AGE continuo… conf.low.4 conf.low… 73.992 bootstra… + 16 AGE continuo… conf.high.4 conf.hig… 76.04 bootstra… Message i 2 more variables: fmt_fn, error diff --git a/tests/testthat/test-boot_ci.R b/tests/testthat/test-boot_ci.R index 7be66a9f..0ccbff96 100644 --- a/tests/testthat/test-boot_ci.R +++ b/tests/testthat/test-boot_ci.R @@ -1,12 +1,13 @@ skip_if_not(do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "boot", reference_pkg = "cardx"))) test_that("boot_ci() works with standard use", { - set.seed(1) x <- cards::ADSL$AGE + set.seed(1) res <- boot_ci(x, type = "perc") expect_snapshot(res) + set.seed(1) res <- cards::ADSL |> cards::ard_continuous( variables = AGE,