Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed May 13, 2024
1 parent f074a3e commit 2abee0e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions R/wilcoxon_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions man/wilcoxon_test.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tests/testthat/test-wilcoxon_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 2abee0e

Please sign in to comment.