From 0607131e9889fcf915a87328f6aa05bd0b6bfd55 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 11 May 2024 14:46:04 +0200 Subject: [PATCH] try --- R/chi_squared_test.R | 2 +- R/mann_whitney_test.R | 2 +- R/t_test.R | 2 +- man/chi_squared_test.Rd | 2 ++ man/mann_whitney_test.Rd | 2 +- man/t_test.Rd | 2 +- 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/R/chi_squared_test.R b/R/chi_squared_test.R index 426883a6..9573dafc 100644 --- a/R/chi_squared_test.R +++ b/R/chi_squared_test.R @@ -38,7 +38,7 @@ #' That Use the Chi‑Squared Statistic. Mathematics, 11, 1982. #' \doi{10.3390/math11091982} #' -#' @examples +#' @examplesIf require("effectsize") #' data(efc) #' efc$weight <- abs(rnorm(nrow(efc), 1, 0.3)) #' diff --git a/R/mann_whitney_test.R b/R/mann_whitney_test.R index d1da31d5..c8157c34 100644 --- a/R/mann_whitney_test.R +++ b/R/mann_whitney_test.R @@ -46,7 +46,7 @@ #' r = |Z| / sqrt(n1 + n2) #' ``` #' -#' @examplesIf requireNamespace("coin", quietly = TRUE) && requireNamespace("survey", quietly = TRUE) +#' @examplesIf require("coin") && require("survey") #' data(efc) #' # Mann-Whitney-U tests for elder's age by elder's sex. #' mann_whitney_test(efc, "e17age", by = "e16sex") diff --git a/R/t_test.R b/R/t_test.R index 3afd0afb..a247298f 100644 --- a/R/t_test.R +++ b/R/t_test.R @@ -10,7 +10,7 @@ #' #' @return A data frame with test results. #' -#' @examplesIf requireNamespace("effectsize") +#' @examplesIf require("effectsize") #' data(sleep) #' # one-sample t-test #' t_test(sleep, "extra") diff --git a/man/chi_squared_test.Rd b/man/chi_squared_test.Rd index 49ba7783..14a2a316 100644 --- a/man/chi_squared_test.Rd +++ b/man/chi_squared_test.Rd @@ -67,6 +67,7 @@ The weighted version of the chi-squared test is based on the a weighted table, using \code{\link[=xtabs]{xtabs()}} as input for \code{chisq.test()}. } \examples{ +\dontshow{if (require("effectsize")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} data(efc) efc$weight <- abs(rnorm(nrow(efc), 1, 0.3)) @@ -78,6 +79,7 @@ chi_squared_test(efc, "c161sex", by = "e16sex", weights = "weight") # Chi-squared test for given probabilities chi_squared_test(efc, "c161sex", probabilities = c(0.3, 0.7)) +\dontshow{\}) # examplesIf} } \references{ Ben-Shachar, M.S., Patil, I., Thériault, R., Wiernik, B.M., diff --git a/man/mann_whitney_test.Rd b/man/mann_whitney_test.Rd index 96073bc4..1ebc10dd 100644 --- a/man/mann_whitney_test.Rd +++ b/man/mann_whitney_test.Rd @@ -71,7 +71,7 @@ Interpretation of the effect size \strong{r}, as a rule-of-thumb: }\if{html}{\out{}} } \examples{ -\dontshow{if (requireNamespace("coin", quietly = TRUE) && requireNamespace("survey", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (require("coin") && require("survey")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} data(efc) # Mann-Whitney-U tests for elder's age by elder's sex. mann_whitney_test(efc, "e17age", by = "e16sex") diff --git a/man/t_test.Rd b/man/t_test.Rd index 9f089cec..7f33ba97 100644 --- a/man/t_test.Rd +++ b/man/t_test.Rd @@ -48,7 +48,7 @@ base R function \code{t.test()}, this function allows for weighted tests and automatically calculates effect sizes. } \examples{ -\dontshow{if (requireNamespace("effectsize")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (require("effectsize")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} data(sleep) # one-sample t-test t_test(sleep, "extra")