diff --git a/R/wilcoxon_test.R b/R/wilcoxon_test.R index da00f9b7..e44a9049 100644 --- a/R/wilcoxon_test.R +++ b/R/wilcoxon_test.R @@ -24,13 +24,13 @@ #' data(mtcars) #' # one-sample test #' wilcoxon_test(mtcars, "mpg") -#' # base R equivalent -#' suppressWarnings(wilcox.test(mtcars$mpg ~ 1)) +#' # base R equivalent, we set exact = FALSE to avoid a warning +#' wilcox.test(mtcars$mpg ~ 1, exact = FALSE) #' #' # paired test #' wilcoxon_test(mtcars, c("mpg", "hp")) -#' # base R equivalent -#' wilcox.test(mtcars$mpg, mtcars$hp, paired = TRUE) +#' # base R equivalent, we set exact = FALSE to avoid a warning +#' wilcox.test(mtcars$mpg, mtcars$hp, paired = TRUE, exact = FALSE) #' #' # when `by` is specified, each group must be of same length #' data(iris) diff --git a/man/wilcoxon_test.Rd b/man/wilcoxon_test.Rd index dacf41d7..7c9cc925 100644 --- a/man/wilcoxon_test.Rd +++ b/man/wilcoxon_test.Rd @@ -73,13 +73,13 @@ normally distributed variables, the \code{t_test()} function can be used (with data(mtcars) # one-sample test wilcoxon_test(mtcars, "mpg") -# base R equivalent -suppressWarnings(wilcox.test(mtcars$mpg ~ 1)) +# base R equivalent, we set exact = FALSE to avoid a warning +wilcox.test(mtcars$mpg ~ 1, exact = FALSE) # paired test wilcoxon_test(mtcars, c("mpg", "hp")) -# base R equivalent -wilcox.test(mtcars$mpg, mtcars$hp, paired = TRUE) +# base R equivalent, we set exact = FALSE to avoid a warning +wilcox.test(mtcars$mpg, mtcars$hp, paired = TRUE, exact = FALSE) # when `by` is specified, each group must be of same length data(iris) diff --git a/tests/testthat/test-wilcoxon_test.R b/tests/testthat/test-wilcoxon_test.R index f3cdee67..2ccfe81a 100644 --- a/tests/testthat/test-wilcoxon_test.R +++ b/tests/testthat/test-wilcoxon_test.R @@ -5,13 +5,13 @@ skip_if_not_installed("coin") test_that("wilcoxon_test", { data(mtcars) out1 <- wilcoxon_test(mtcars, "mpg") - out2 <- suppressWarnings(wilcox.test(mtcars$mpg ~ 1)) + out2 <- wilcox.test(mtcars$mpg ~ 1, exact = FALSE) expect_equal(out1$v, out2$statistic, tolerance = 1e-4, ignore_attr = TRUE) expect_equal(out1$p, out2$p.value, tolerance = 1e-4, ignore_attr = TRUE) expect_snapshot(print(out1)) out1 <- wilcoxon_test(mtcars, c("mpg", "hp")) - out2 <- suppressWarnings(wilcox.test(mtcars$mpg, mtcars$hp, paired = TRUE)) + out2 <- wilcox.test(mtcars$mpg, mtcars$hp, paired = TRUE, exact = FALSE) expect_equal(out1$v, out2$statistic, tolerance = 1e-4, ignore_attr = TRUE) expect_equal(out1$p, out2$p.value, tolerance = 1e-4, ignore_attr = TRUE) expect_snapshot(print(out1))