diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index e878a8cc..8b0aea4b 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -14,7 +14,7 @@ Pre-review Checklist (if item does not apply, mark is as complete) - [ ] If a bug was fixed, a unit test was added. - [ ] If a new `ard_*()` function was added, it passes the ARD structural checks from `cards::check_ard_structure()`. - [ ] If a new `ard_*()` function was added, `set_cli_abort_call()` has been set. -- [ ] If a new `ard_*()` function was added and it depends on another package (such as, `broom`), `is_pkg_installed("broom", reference_pkg = "cardx")` has been set in the function call and the following added to the roxygen comments: `@examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom"", reference_pkg = "cardx"))` +- [ ] If a new `ard_*()` function was added and it depends on another package (such as, `broom`), `is_pkg_installed("broom")` has been set in the function call and the following added to the roxygen comments: `@examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom""))` - [ ] Code coverage is suitable for any new functions/features (generally, 100% coverage for new code): `devtools::test_coverage()` Reviewer Checklist (if item does not apply, mark is as complete) diff --git a/DESCRIPTION b/DESCRIPTION index 067d9982..7d6eb957 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: cardx Title: Extra Analysis Results Data Utilities -Version: 0.2.1.9007 +Version: 0.2.1.9008 Authors@R: c( person("Daniel", "Sjoberg", , "danield.sjoberg@gmail.com", role = c("aut", "cre")), person("Abinaya", "Yogasekaram", , "abinaya.yogasekaram@contractors.roche.com", role = "aut"), diff --git a/NEWS.md b/NEWS.md index 0870b48c..6f436f17 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# cardx 0.2.1.9007 +# cardx 0.2.1.9008 # cardx 0.2.1 diff --git a/R/add_total_n.survey.design.R b/R/add_total_n.survey.design.R index 80d51579..32d57bbf 100644 --- a/R/add_total_n.survey.design.R +++ b/R/add_total_n.survey.design.R @@ -9,7 +9,7 @@ #' @return an ARD data frame of class 'card' #' @export #' -#' @examplesIf cardx:::is_pkg_installed("survey", reference_pkg = "cardx") +#' @examplesIf cardx:::is_pkg_installed("survey") #' svy_titanic <- survey::svydesign(~1, data = as.data.frame(Titanic), weights = ~Freq) #' #' ard_total_n(svy_titanic) diff --git a/R/ard_aod_wald_test.R b/R/ard_aod_wald_test.R index dc6fb151..4bc98464 100644 --- a/R/ard_aod_wald_test.R +++ b/R/ard_aod_wald_test.R @@ -11,14 +11,14 @@ #' @return data frame #' @export #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("aod", "broom.helpers"), reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("aod", "broom.helpers"))) #' lm(AGE ~ ARM, data = cards::ADSL) |> #' ard_aod_wald_test() ard_aod_wald_test <- function(x, tidy_fun = broom.helpers::tidy_with_broom_or_parameters, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed(c("aod", "broom.helpers"), reference_pkg = "cardx") + check_pkg_installed(c("aod", "broom.helpers")) # check inputs --------------------------------------------------------------- check_not_missing(x) diff --git a/R/ard_attributes.survey.design.R b/R/ard_attributes.survey.design.R index b3f06976..ebbe8450 100644 --- a/R/ard_attributes.survey.design.R +++ b/R/ard_attributes.survey.design.R @@ -21,7 +21,7 @@ #' @return an ARD data frame of class 'card' #' @export #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "survey", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "survey")) #' data(api, package = "survey") #' dclus1 <- survey::svydesign(id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc) #' diff --git a/R/ard_car_anova.R b/R/ard_car_anova.R index e273382e..7da98954 100644 --- a/R/ard_car_anova.R +++ b/R/ard_car_anova.R @@ -8,7 +8,7 @@ #' @return data frame #' @export #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("broom.helpers", "car", "parameters"), reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("broom.helpers", "car", "parameters"))) #' lm(AGE ~ ARM, data = cards::ADSL) |> #' ard_car_anova() #' @@ -18,7 +18,7 @@ ard_car_anova <- function(x, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed(pkg = c("broom.helpers", "car", "parameters"), reference_pkg = "cardx") + check_pkg_installed(pkg = c("broom.helpers", "car", "parameters")) # check inputs --------------------------------------------------------------- check_not_missing(x) diff --git a/R/ard_car_vif.R b/R/ard_car_vif.R index 8492dcae..6328d795 100644 --- a/R/ard_car_vif.R +++ b/R/ard_car_vif.R @@ -14,14 +14,14 @@ #' @rdname ard_car_vif #' @export #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "car", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "car")) #' lm(AGE ~ ARM + SEX, data = cards::ADSL) |> #' ard_car_vif() ard_car_vif <- function(x, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed("car", reference_pkg = "cardx") + check_pkg_installed("car") # check inputs --------------------------------------------------------------- check_not_missing(x) diff --git a/R/ard_categorical.survey.design.R b/R/ard_categorical.survey.design.R index 2bb29e43..bdcff33b 100644 --- a/R/ard_categorical.survey.design.R +++ b/R/ard_categorical.survey.design.R @@ -38,7 +38,7 @@ #' @return an ARD data frame of class 'card' #' @export #' -#' @examplesIf cardx:::is_pkg_installed("survey", reference_pkg = "cardx") +#' @examplesIf cardx:::is_pkg_installed("survey") #' svy_titanic <- survey::svydesign(~1, data = as.data.frame(Titanic), weights = ~Freq) #' #' ard_categorical(svy_titanic, variables = c(Class, Age), by = Survived) @@ -58,7 +58,7 @@ ard_categorical.survey.design <- function(data, ), ...) { set_cli_abort_call() - check_pkg_installed(pkg = "survey", reference_pkg = "cardx") + check_pkg_installed(pkg = "survey") check_dots_empty() deff <- TRUE # we may update in the future to make this an argument for users diff --git a/R/ard_categorical_ci.R b/R/ard_categorical_ci.R index 8200dc12..cb7fb53e 100644 --- a/R/ard_categorical_ci.R +++ b/R/ard_categorical_ci.R @@ -27,7 +27,7 @@ #' @return an ARD data frame #' @name ard_categorical_ci #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom")) #' # compute CI for binary variables #' ard_categorical_ci(mtcars, variables = c(vs, am), method = "wilson") #' @@ -63,7 +63,7 @@ ard_categorical_ci.data.frame <- function(data, check_dots_empty() # check installed packages --------------------------------------------------- - check_pkg_installed(pkg = "broom", reference_pkg = "cardx") + check_pkg_installed(pkg = "broom") # process inputs ------------------------------------------------------------- cards::process_selectors(data, variables = {{ variables }}, by = {{ by }}) diff --git a/R/ard_categorical_ci.survey.design.R b/R/ard_categorical_ci.survey.design.R index 82347ae3..223c5f0d 100644 --- a/R/ard_categorical_ci.survey.design.R +++ b/R/ard_categorical_ci.survey.design.R @@ -15,7 +15,7 @@ #' @return ARD data frame #' @export #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "survey", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "survey")) #' data(api, package = "survey") #' dclus1 <- survey::svydesign(id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc) #' diff --git a/R/ard_continuous.survey.design.R b/R/ard_continuous.survey.design.R index 0fe3617d..b0e3527b 100644 --- a/R/ard_continuous.survey.design.R +++ b/R/ard_continuous.survey.design.R @@ -35,7 +35,7 @@ #' @return an ARD data frame of class 'card' #' @export #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "survey", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "survey")) #' data(api, package = "survey") #' dclus1 <- survey::svydesign(id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc) #' @@ -53,7 +53,7 @@ ard_continuous.survey.design <- function(data, variables, by = NULL, check_dots_empty() # check installed packages --------------------------------------------------- - check_pkg_installed(pkg = "survey", reference_pkg = "cardx") + check_pkg_installed(pkg = "survey") # check inputs --------------------------------------------------------------- check_not_missing(variables) diff --git a/R/ard_continuous_ci.R b/R/ard_continuous_ci.R index 57ed23f5..b123f074 100644 --- a/R/ard_continuous_ci.R +++ b/R/ard_continuous_ci.R @@ -11,7 +11,7 @@ #' @return ARD data frame #' @name ard_continuous_ci #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom")) #' ard_continuous_ci(mtcars, variables = c(mpg, hp), method = "wilcox.test") #' ard_continuous_ci(mtcars, variables = mpg, by = am, method = "t.test") NULL diff --git a/R/ard_continuous_ci.survey.design.R b/R/ard_continuous_ci.survey.design.R index 60878f2e..2b209410 100644 --- a/R/ard_continuous_ci.survey.design.R +++ b/R/ard_continuous_ci.survey.design.R @@ -19,7 +19,7 @@ #' @return ARD data frame #' @export #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "survey", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "survey")) #' data(api, package = "survey") #' dclus1 <- survey::svydesign(id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc) #' diff --git a/R/ard_dichotomous.survey.design.R b/R/ard_dichotomous.survey.design.R index 99180f47..05489525 100644 --- a/R/ard_dichotomous.survey.design.R +++ b/R/ard_dichotomous.survey.design.R @@ -11,7 +11,7 @@ #' @return an ARD data frame of class 'card' #' @export #' -#' @examplesIf cardx:::is_pkg_installed("survey", reference_pkg = "cardx") +#' @examplesIf cardx:::is_pkg_installed("survey") #' survey::svydesign(ids = ~1, data = mtcars, weights = ~1) |> #' ard_dichotomous(by = vs, variables = c(cyl, am), value = list(cyl = 4)) ard_dichotomous.survey.design <- function(data, @@ -32,7 +32,7 @@ ard_dichotomous.survey.design <- function(data, ...) { set_cli_abort_call() check_dots_empty() - check_pkg_installed(pkg = "survey", reference_pkg = "cardx") + check_pkg_installed(pkg = "survey") # check inputs --------------------------------------------------------------- check_not_missing(variables) diff --git a/R/ard_effectsize_cohens_d.R b/R/ard_effectsize_cohens_d.R index d7a59c04..b9be6927 100644 --- a/R/ard_effectsize_cohens_d.R +++ b/R/ard_effectsize_cohens_d.R @@ -30,7 +30,7 @@ #' The data are then passed as #' `effectsize::cohens_d(x = data_wide[[]], y = data_wide[[]], paired = TRUE, ...)`. #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("effectsize", "parameters"), reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("effectsize", "parameters"))) #' cards::ADSL |> #' dplyr::filter(ARM %in% c("Placebo", "Xanomeline High Dose")) |> #' ard_effectsize_cohens_d(by = ARM, variables = AGE) @@ -52,7 +52,7 @@ ard_effectsize_cohens_d <- function(data, by, variables, conf.level = 0.95, ...) set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed(c("effectsize", "parameters"), reference_pkg = "cardx") + check_pkg_installed(c("effectsize", "parameters")) # check/process inputs ------------------------------------------------------- check_not_missing(data) @@ -103,7 +103,7 @@ ard_effectsize_paired_cohens_d <- function(data, by, variables, id, conf.level = set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed(c("effectsize", "parameters"), reference_pkg = "cardx") + check_pkg_installed(c("effectsize", "parameters")) # check/process inputs ------------------------------------------------------- check_not_missing(data) @@ -175,7 +175,7 @@ ard_effectsize_paired_cohens_d <- function(data, by, variables, id, conf.level = #' #' @return ARD data frame #' @keywords internal -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("effectsize", "parameters"), reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("effectsize", "parameters"))) #' cardx:::.format_cohens_d_results( #' by = "ARM", #' variable = "AGE", diff --git a/R/ard_effectsize_hedges_g.R b/R/ard_effectsize_hedges_g.R index 97c4eff8..1192f69d 100644 --- a/R/ard_effectsize_hedges_g.R +++ b/R/ard_effectsize_hedges_g.R @@ -30,7 +30,7 @@ #' The data are then passed as #' `effectsize::hedges_g(x = data_wide[[]], y = data_wide[[]], paired = TRUE, ...)`. #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("effectsize", "parameters"), reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("effectsize", "parameters"))) #' cards::ADSL |> #' dplyr::filter(ARM %in% c("Placebo", "Xanomeline High Dose")) |> #' ard_effectsize_hedges_g(by = ARM, variables = AGE) @@ -52,7 +52,7 @@ ard_effectsize_hedges_g <- function(data, by, variables, conf.level = 0.95, ...) set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed(c("effectsize", "parameters"), reference_pkg = "cardx") + check_pkg_installed(c("effectsize", "parameters")) # check/process inputs ------------------------------------------------------- check_not_missing(data) @@ -101,7 +101,7 @@ ard_effectsize_paired_hedges_g <- function(data, by, variables, id, conf.level = set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed(c("effectsize", "parameters"), reference_pkg = "cardx") + check_pkg_installed(c("effectsize", "parameters")) # check/process inputs ------------------------------------------------------- check_not_missing(data) @@ -158,7 +158,7 @@ ard_effectsize_paired_hedges_g <- function(data, by, variables, id, conf.level = #' #' @return ARD data frame #' @keywords internal -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("effectsize", "parameters"), reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("effectsize", "parameters"))) #' cardx:::.format_hedges_g_results( #' by = "ARM", #' variable = "AGE", diff --git a/R/ard_emmeans_mean_difference.R b/R/ard_emmeans_mean_difference.R index 0ea5ff56..6160bb77 100644 --- a/R/ard_emmeans_mean_difference.R +++ b/R/ard_emmeans_mean_difference.R @@ -29,7 +29,7 @@ #' @return ARD data frame #' @export #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "emmeans", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "emmeans")) #' ard_emmeans_mean_difference( #' data = mtcars, #' formula = mpg ~ am + cyl, @@ -55,7 +55,7 @@ ard_emmeans_mean_difference <- function(data, formula, method, set_cli_abort_call() # check package installation ------------------------------------------------- - check_pkg_installed(c("emmeans", package), reference_pkg = "cardx") + check_pkg_installed(c("emmeans", package)) check_not_missing(data) check_not_missing(formula) check_not_missing(method) diff --git a/R/ard_missing.survey.design.R b/R/ard_missing.survey.design.R index acb90c00..499c69ef 100644 --- a/R/ard_missing.survey.design.R +++ b/R/ard_missing.survey.design.R @@ -7,7 +7,7 @@ #' @return an ARD data frame of class 'card' #' @export #' -#' @examplesIf cardx:::is_pkg_installed("survey", reference_pkg = "cardx") +#' @examplesIf cardx:::is_pkg_installed("survey") #' svy_titanic <- survey::svydesign(~1, data = as.data.frame(Titanic), weights = ~Freq) #' #' ard_missing(svy_titanic, variables = c(Class, Age), by = Survived) @@ -37,7 +37,7 @@ ard_missing.survey.design <- function(data, ...) { set_cli_abort_call() check_dots_empty() - check_pkg_installed(pkg = "survey", reference_pkg = "cardx") + check_pkg_installed(pkg = "survey") # process inputs ------------------------------------------------------------- check_not_missing(variables) diff --git a/R/ard_regression.R b/R/ard_regression.R index a08f4688..2901a3cb 100644 --- a/R/ard_regression.R +++ b/R/ard_regression.R @@ -11,7 +11,7 @@ #' @return data frame #' @name ard_regression #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom.helpers", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom.helpers")) #' lm(AGE ~ ARM, data = cards::ADSL) |> #' ard_regression(add_estimate_to_reference_rows = TRUE) NULL @@ -28,7 +28,7 @@ ard_regression.default <- function(x, tidy_fun = broom.helpers::tidy_with_broom_ set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed(pkg = "broom.helpers", reference_pkg = "cardx") + check_pkg_installed(pkg = "broom.helpers") # check inputs --------------------------------------------------------------- check_not_missing(x) diff --git a/R/ard_regression_basic.R b/R/ard_regression_basic.R index c9a5b3eb..cc33c58a 100644 --- a/R/ard_regression_basic.R +++ b/R/ard_regression_basic.R @@ -26,7 +26,7 @@ #' @name ard_regression_basic #' @export #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom.helpers", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom.helpers")) #' lm(AGE ~ ARM, data = cards::ADSL) |> #' ard_regression_basic() ard_regression_basic <- function(x, tidy_fun = broom.helpers::tidy_with_broom_or_parameters, @@ -38,7 +38,7 @@ ard_regression_basic <- function(x, tidy_fun = broom.helpers::tidy_with_broom_or set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed(pkg = "broom.helpers", reference_pkg = "cardx") + check_pkg_installed(pkg = "broom.helpers") # check inputs --------------------------------------------------------------- check_not_missing(x) diff --git a/R/ard_smd_smd.R b/R/ard_smd_smd.R index 872400bc..c8b107b6 100644 --- a/R/ard_smd_smd.R +++ b/R/ard_smd_smd.R @@ -23,14 +23,14 @@ #' @return ARD data frame #' @export #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "smd", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "smd")) #' ard_smd_smd(cards::ADSL, by = SEX, variables = AGE) #' ard_smd_smd(cards::ADSL, by = SEX, variables = AGEGR1) ard_smd_smd <- function(data, by, variables, std.error = TRUE, conf.level = 0.95, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed("smd", reference_pkg = "cardx") + check_pkg_installed("smd") # check/process inputs ------------------------------------------------------- check_not_missing(data) diff --git a/R/ard_stats_anova.R b/R/ard_stats_anova.R index 17c6bfdc..2bb1c1ff 100644 --- a/R/ard_stats_anova.R +++ b/R/ard_stats_anova.R @@ -37,7 +37,7 @@ #' @return ARD data frame #' @name ard_stats_anova #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("broom", "withr", "lme4"), reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("broom", "withr", "lme4"))) #' anova( #' lm(mpg ~ am, mtcars), #' lm(mpg ~ am + hp, mtcars) @@ -73,7 +73,7 @@ ard_stats_anova.anova <- function(x, method_text = "ANOVA results from `stats::a # check inputs --------------------------------------------------------------- check_dots_empty() - check_pkg_installed("broom", reference_pkg = "cardx") + check_pkg_installed("broom") check_string(method_text) # return df in cards formats ------------------------------------------------- @@ -100,7 +100,7 @@ ard_stats_anova.data.frame <- function(x, # check inputs --------------------------------------------------------------- check_dots_empty() - check_pkg_installed(c("broom", "withr", package), reference_pkg = "cardx") + check_pkg_installed(c("broom", "withr", package)) check_not_missing(formulas) check_class(formulas, cls = "list") walk( diff --git a/R/ard_stats_aov.R b/R/ard_stats_aov.R index 285b5113..42ec9112 100644 --- a/R/ard_stats_aov.R +++ b/R/ard_stats_aov.R @@ -10,13 +10,13 @@ #' @return ARD data frame #' @export #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("broom.helpers", "parameters"), reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("broom.helpers", "parameters"))) #' ard_stats_aov(AGE ~ ARM, data = cards::ADSL) ard_stats_aov <- function(formula, data, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed(c("broom.helpers", "parameters"), reference_pkg = "cardx") + check_pkg_installed(c("broom.helpers", "parameters")) # check/process inputs ------------------------------------------------------- check_not_missing(formula) diff --git a/R/ard_stats_chisq_test.R b/R/ard_stats_chisq_test.R index 48b47701..bbb3bca5 100644 --- a/R/ard_stats_chisq_test.R +++ b/R/ard_stats_chisq_test.R @@ -17,14 +17,14 @@ #' @return ARD data frame #' @export #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom")) #' cards::ADSL |> #' ard_stats_chisq_test(by = "ARM", variables = "AGEGR1") ard_stats_chisq_test <- function(data, by, variables, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed("broom", reference_pkg = "cardx") + check_pkg_installed("broom") # check/process inputs ------------------------------------------------------- check_not_missing(data) diff --git a/R/ard_stats_fisher_test.R b/R/ard_stats_fisher_test.R index e7b87179..f7e7d275 100644 --- a/R/ard_stats_fisher_test.R +++ b/R/ard_stats_fisher_test.R @@ -19,14 +19,14 @@ #' @return ARD data frame #' @export #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom")) #' cards::ADSL[1:30, ] |> #' ard_stats_fisher_test(by = "ARM", variables = "AGEGR1") ard_stats_fisher_test <- function(data, by, variables, conf.level = 0.95, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed("broom", reference_pkg = "cardx") + check_pkg_installed("broom") # check/process inputs ------------------------------------------------------- check_not_missing(data) diff --git a/R/ard_stats_kruskal_test.R b/R/ard_stats_kruskal_test.R index cff85817..607337a6 100644 --- a/R/ard_stats_kruskal_test.R +++ b/R/ard_stats_kruskal_test.R @@ -16,14 +16,14 @@ #' @return ARD data frame #' @export #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom")) #' cards::ADSL |> #' ard_stats_kruskal_test(by = "ARM", variables = "AGE") ard_stats_kruskal_test <- function(data, by, variables) { set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed("broom", reference_pkg = "cardx") + check_pkg_installed("broom") # check/process inputs ------------------------------------------------------- check_not_missing(data) diff --git a/R/ard_stats_mcnemar_test.R b/R/ard_stats_mcnemar_test.R index 7955af3d..607ae45d 100644 --- a/R/ard_stats_mcnemar_test.R +++ b/R/ard_stats_mcnemar_test.R @@ -25,7 +25,7 @@ #' The data is passed as `stats::mcnemar.test(x = data[[variable]], y = data[[by]], ...)`. #' Please use `table(x = data[[variable]], y = data[[by]])` to check the contingency table. #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom")) #' cards::ADSL |> #' ard_stats_mcnemar_test(by = "SEX", variables = "EFFFL") #' @@ -47,7 +47,7 @@ ard_stats_mcnemar_test <- function(data, by, variables, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed("broom", reference_pkg = "cardx") + check_pkg_installed("broom") # check/process inputs ------------------------------------------------------- check_not_missing(data) @@ -88,7 +88,7 @@ ard_stats_mcnemar_test_long <- function(data, by, variables, id, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed("broom", reference_pkg = "cardx") + check_pkg_installed("broom") # check/process inputs ------------------------------------------------------- check_not_missing(data) @@ -138,7 +138,7 @@ ard_stats_mcnemar_test_long <- function(data, by, variables, id, ...) { #' #' @return ARD data frame #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom")) #' cardx:::.format_mcnemartest_results( #' by = "ARM", #' variable = "AGE", diff --git a/R/ard_stats_mood_test.R b/R/ard_stats_mood_test.R index c5ca5acc..d46d6972 100644 --- a/R/ard_stats_mood_test.R +++ b/R/ard_stats_mood_test.R @@ -22,14 +22,14 @@ #' @rdname ard_stats_mood_test #' @export #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom")) #' cards::ADSL |> #' ard_stats_mood_test(by = "SEX", variables = "AGE") ard_stats_mood_test <- function(data, by, variables, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed("broom", reference_pkg = "cardx") + check_pkg_installed("broom") # check/process inputs ------------------------------------------------------- check_not_missing(data) @@ -73,7 +73,7 @@ ard_stats_mood_test <- function(data, by, variables, ...) { #' #' @return ARD data frame #' @keywords internal -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom")) #' cardx:::.format_moodtest_results( #' by = "SEX", #' variable = "AGE", diff --git a/R/ard_stats_oneway_test.R b/R/ard_stats_oneway_test.R index 7129a1f5..9c67eebd 100644 --- a/R/ard_stats_oneway_test.R +++ b/R/ard_stats_oneway_test.R @@ -10,13 +10,13 @@ #' @return ARD data frame #' @export #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom")) #' ard_stats_oneway_test(AGE ~ ARM, data = cards::ADSL) ard_stats_oneway_test <- function(formula, data, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed(c("broom"), reference_pkg = "cardx") + check_pkg_installed(c("broom")) # check/process inputs ------------------------------------------------------- check_not_missing(formula) diff --git a/R/ard_stats_poisson_test.R b/R/ard_stats_poisson_test.R index dd833d1d..c705890d 100644 --- a/R/ard_stats_poisson_test.R +++ b/R/ard_stats_poisson_test.R @@ -24,7 +24,7 @@ #' Poisson comparison of two rate parameters will be performed on the levels of `by`. If `by` has more than 2 #' levels, an error will occur. #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom")) #' # Exact test of rate parameter against null hypothesis #' cards::ADTTE |> #' ard_stats_poisson_test(variables = c(CNSR, AVAL)) @@ -41,7 +41,7 @@ ard_stats_poisson_test <- function(data, variables, na.rm = TRUE, by = NULL, con set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed("broom", reference_pkg = "cardx") + check_pkg_installed("broom") # check/process inputs ------------------------------------------------------- check_not_missing(data) @@ -104,7 +104,7 @@ ard_stats_poisson_test <- function(data, variables, na.rm = TRUE, by = NULL, con #' #' @return ARD data frame #' @keywords internal -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom")) #' cardx:::.format_poissontest_results( #' by = "ARM", #' variables = c("CNSR", "AVAL"), diff --git a/R/ard_stats_prop_test.R b/R/ard_stats_prop_test.R index 94edda3d..9a033304 100644 --- a/R/ard_stats_prop_test.R +++ b/R/ard_stats_prop_test.R @@ -17,14 +17,14 @@ #' @return ARD data frame #' @export #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom")) #' mtcars |> #' ard_stats_prop_test(by = vs, variables = am) ard_stats_prop_test <- function(data, by, variables, conf.level = 0.95, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed(pkg = "broom", reference_pkg = "cardx") + check_pkg_installed(pkg = "broom") # check inputs --------------------------------------------------------------- check_not_missing(data) diff --git a/R/ard_stats_t_test.R b/R/ard_stats_t_test.R index 9205c978..d1105ea3 100644 --- a/R/ard_stats_t_test.R +++ b/R/ard_stats_t_test.R @@ -29,7 +29,7 @@ #' The data are then passed as #' `t.test(x = data_wide[[]], y = data_wide[[]], paired = TRUE, ...)`. #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom")) #' cards::ADSL |> #' dplyr::filter(ARM %in% c("Placebo", "Xanomeline High Dose")) |> #' ard_stats_t_test(by = ARM, variables = c(AGE, BMIBL)) @@ -49,7 +49,7 @@ ard_stats_t_test <- function(data, variables, by = NULL, conf.level = 0.95, ...) set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed("broom", reference_pkg = "cardx") + check_pkg_installed("broom") # check/process inputs ------------------------------------------------------- check_not_missing(data) @@ -93,7 +93,7 @@ ard_stats_paired_t_test <- function(data, by, variables, id, conf.level = 0.95, set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed("broom", reference_pkg = "cardx") + check_pkg_installed("broom") # check/process inputs ------------------------------------------------------- check_not_missing(data) @@ -144,7 +144,7 @@ ard_stats_paired_t_test <- function(data, by, variables, id, conf.level = 0.95, #' #' @return ARD data frame #' @keywords internal -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom")) #' cardx:::.format_ttest_results( #' by = "ARM", #' variable = "AGE", diff --git a/R/ard_stats_t_test_onesample.R b/R/ard_stats_t_test_onesample.R index 52861b67..63ba130c 100644 --- a/R/ard_stats_t_test_onesample.R +++ b/R/ard_stats_t_test_onesample.R @@ -16,14 +16,14 @@ #' @return ARD data frame #' @export #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom")) #' cards::ADSL |> #' ard_stats_t_test_onesample(by = ARM, variables = AGE) ard_stats_t_test_onesample <- function(data, variables, by = dplyr::group_vars(data), conf.level = 0.95, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed("broom", reference_pkg = "cardx") + check_pkg_installed("broom") # check/process inputs ------------------------------------------------------- check_not_missing(data) diff --git a/R/ard_stats_wilcox_test.R b/R/ard_stats_wilcox_test.R index ef450b03..b8665766 100644 --- a/R/ard_stats_wilcox_test.R +++ b/R/ard_stats_wilcox_test.R @@ -29,7 +29,7 @@ #' The data are then passed as #' `wilcox.test(x = data_wide[[]], y = data_wide[[]], paired = TRUE, ...)`. #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom")) #' cards::ADSL |> #' dplyr::filter(ARM %in% c("Placebo", "Xanomeline High Dose")) |> #' ard_stats_wilcox_test(by = "ARM", variables = "AGE") @@ -49,7 +49,7 @@ ard_stats_wilcox_test <- function(data, variables, by = NULL, conf.level = 0.95, set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed("broom", reference_pkg = "cardx") + check_pkg_installed("broom") # check/process inputs ------------------------------------------------------- check_not_missing(data) @@ -99,7 +99,7 @@ ard_stats_paired_wilcox_test <- function(data, by, variables, id, conf.level = 0 set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed("broom", reference_pkg = "cardx") + check_pkg_installed("broom") # check/process inputs ------------------------------------------------------- check_not_missing(data) @@ -151,7 +151,7 @@ ard_stats_paired_wilcox_test <- function(data, by, variables, id, conf.level = 0 #' #' @return ARD data frame #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom")) #' # Pre-processing ADSL to have grouping factor (ARM here) with 2 levels #' ADSL <- cards::ADSL |> #' dplyr::filter(ARM %in% c("Placebo", "Xanomeline High Dose")) |> diff --git a/R/ard_stats_wilcox_test_onesample.R b/R/ard_stats_wilcox_test_onesample.R index 4eb43887..7b1cb840 100644 --- a/R/ard_stats_wilcox_test_onesample.R +++ b/R/ard_stats_wilcox_test_onesample.R @@ -16,14 +16,14 @@ #' @return ARD data frame #' @export #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom")) #' cards::ADSL |> #' ard_stats_wilcox_test_onesample(by = ARM, variables = AGE) ard_stats_wilcox_test_onesample <- function(data, variables, by = dplyr::group_vars(data), conf.level = 0.95, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed("broom", reference_pkg = "cardx") + check_pkg_installed("broom") # check/process inputs ------------------------------------------------------- check_not_missing(data) diff --git a/R/ard_survey_svychisq.R b/R/ard_survey_svychisq.R index abcd6c20..9fd996c6 100644 --- a/R/ard_survey_svychisq.R +++ b/R/ard_survey_svychisq.R @@ -20,7 +20,7 @@ #' @return ARD data frame #' @export #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survey", "broom"), reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survey", "broom"))) #' data(api, package = "survey") #' dclus1 <- survey::svydesign(id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc) #' @@ -29,7 +29,7 @@ ard_survey_svychisq <- function(data, by, variables, statistic = "F", ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed(c("survey", "broom"), reference_pkg = "cardx") + check_pkg_installed(c("survey", "broom")) # check/process inputs ------------------------------------------------------- check_not_missing(data) diff --git a/R/ard_survey_svyranktest.R b/R/ard_survey_svyranktest.R index dd3e5d91..c18c3ca4 100644 --- a/R/ard_survey_svyranktest.R +++ b/R/ard_survey_svyranktest.R @@ -17,7 +17,7 @@ #' @return ARD data frame #' @export #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survey", "broom"), reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survey", "broom"))) #' data(api, package = "survey") #' dclus2 <- survey::svydesign(id = ~ dnum + snum, fpc = ~ fpc1 + fpc2, data = apiclus2) #' @@ -29,7 +29,7 @@ ard_survey_svyranktest <- function(data, by, variables, test, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed(c("survey", "broom"), reference_pkg = "cardx") + check_pkg_installed(c("survey", "broom")) # check/process inputs ------------------------------------------------------- check_not_missing(data) diff --git a/R/ard_survey_svyttest.R b/R/ard_survey_svyttest.R index 916cf789..ef894aba 100644 --- a/R/ard_survey_svyttest.R +++ b/R/ard_survey_svyttest.R @@ -17,7 +17,7 @@ #' @return ARD data frame #' @export #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survey", "broom"), reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survey", "broom"))) #' data(api, package = "survey") #' dclus2 <- survey::svydesign(id = ~ dnum + snum, fpc = ~ fpc1 + fpc2, data = apiclus2) #' @@ -26,7 +26,7 @@ ard_survey_svyttest <- function(data, by, variables, conf.level = 0.95, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed(c("survey", "broom"), reference_pkg = "cardx") + check_pkg_installed(c("survey", "broom")) # check/process inputs ------------------------------------------------------- check_not_missing(data) diff --git a/R/ard_survival_survdiff.R b/R/ard_survival_survdiff.R index 9548b692..806af14f 100644 --- a/R/ard_survival_survdiff.R +++ b/R/ard_survival_survdiff.R @@ -14,7 +14,7 @@ #' @return an ARD data frame of class 'card' #' @export #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survival", "broom", "ggsurvfit"), reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survival", "broom", "ggsurvfit"))) #' library(survival) #' library(ggsurvfit) #' @@ -23,7 +23,7 @@ ard_survival_survdiff <- function(formula, data, rho = 0, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed(c("survival", "broom"), reference_pkg = "cardx") + check_pkg_installed(c("survival", "broom")) # check/process inputs ------------------------------------------------------- check_not_missing(formula) diff --git a/R/ard_survival_survfit.R b/R/ard_survival_survfit.R index 11a5d33e..35b192f2 100644 --- a/R/ard_survival_survfit.R +++ b/R/ard_survival_survfit.R @@ -65,7 +65,7 @@ #' * Times should be provided using the same scale as the time variable used to fit the provided #' survival fit model. #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survival", "broom", "ggsurvfit"), reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survival", "broom", "ggsurvfit"))) #' library(survival) #' library(ggsurvfit) #' @@ -106,7 +106,7 @@ ard_survival_survfit.default <- function(x, times = NULL, probs = NULL, type = N set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed(c("survival", "broom"), reference_pkg = "cardx") + check_pkg_installed(c("survival", "broom")) # check/process inputs ------------------------------------------------------- check_class(x, cls = c("survfit")) @@ -195,7 +195,7 @@ ard_survival_survfit.data.frame <- function(x, y, variables, #' #' @return a `tibble` #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survival", "broom"), reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survival", "broom"))) #' survival::survfit(survival::Surv(AVAL, CNSR) ~ TRTA, cards::ADTTE) |> #' cardx:::.process_survfit_time(times = c(60, 180), type = "risk") #' @@ -291,7 +291,7 @@ ard_survival_survfit.data.frame <- function(x, y, variables, #' #' @return a `tibble` #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "survival", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "survival")) #' survival::survfit(survival::Surv(AVAL, CNSR) ~ TRTA, cards::ADTTE) |> #' cardx:::.process_survfit_probs(probs = c(0.25, 0.75)) #' @@ -351,7 +351,7 @@ extract_multi_strata <- function(x, df_stat) { #' #' @return an ARD data frame of class 'card' #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survival", "broom"), reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survival", "broom"))) #' cardx:::.format_survfit_results( #' broom::tidy(survival::survfit(survival::Surv(AVAL, CNSR) ~ TRTA, cards::ADTTE)) #' ) diff --git a/R/ard_survival_survfit_diff.R b/R/ard_survival_survfit_diff.R index e5cd3fb6..406e05e0 100644 --- a/R/ard_survival_survfit_diff.R +++ b/R/ard_survival_survfit_diff.R @@ -12,7 +12,7 @@ #' @return an ARD data frame of class 'card' #' @export #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survival", "ggsurvfit"), reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survival", "ggsurvfit"))) #' library(ggsurvfit) #' library(survival) #' @@ -22,7 +22,7 @@ ard_survival_survfit_diff <- function(x, times, conf.level = 0.95) { set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed(c("survival", "broom"), reference_pkg = "cardx") + check_pkg_installed(c("survival", "broom")) check_not_missing(x) check_not_missing(times) check_class(x, "survfit") diff --git a/R/construction_helpers.R b/R/construction_helpers.R index 8445dbc8..70571a2c 100644 --- a/R/construction_helpers.R +++ b/R/construction_helpers.R @@ -42,7 +42,7 @@ #' @return depends on the calling function #' @name construction_helpers #' -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("withr", "lme4", "broom.helpers", "broom.mixed"), reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("withr", "lme4", "broom.helpers", "broom.mixed"))) #' construct_model( #' data = mtcars, #' formula = am ~ mpg + (1 | vs), @@ -73,7 +73,7 @@ construct_model.data.frame <- function(data, formula, method, method.args = list set_cli_abort_call() # check pkg installations ---------------------------------------------------- check_dots_empty() - check_pkg_installed(c("withr", package), reference_pkg = "cardx") + check_pkg_installed(c("withr", package)) check_not_missing(formula) check_class(formula, cls = "formula") @@ -115,7 +115,7 @@ construct_model.survey.design <- function(data, formula, method, method.args = l set_cli_abort_call() # check pkg installations ---------------------------------------------------- check_dots_empty() - check_pkg_installed(c("withr", package), reference_pkg = "cardx") + check_pkg_installed(c("withr", package)) check_not_missing(formula) check_class(formula, cls = "formula") diff --git a/R/import-standalone-check_pkg_installed.R b/R/import-standalone-check_pkg_installed.R index 8f6522da..ec564e17 100644 --- a/R/import-standalone-check_pkg_installed.R +++ b/R/import-standalone-check_pkg_installed.R @@ -1,11 +1,11 @@ # Standalone file: do not edit by hand -# Source: +# Source: # ---------------------------------------------------------------------- # # --- -# repo: ddsjoberg/standalone +# repo: insightsengineering/standalone # file: standalone-check_pkg_installed.R -# last-updated: 2024-04-10 +# last-updated: 2024-04-19 # license: https://unlicense.org # dependencies: standalone-cli_call_env.R # imports: [rlang, dplyr, tidyr] @@ -32,18 +32,27 @@ #' - `get_pkg_dependencies()` returns a tibble with all #' dependencies of a specific package. #' -#' - `get_min_version_required()` will return, if any, the minimum version -#' of `pkg` required by `reference_pkg`. +#' - `get_min_version_required()` will return, if any, the minimum version of `pkg` required by `ref`. #' #' @param pkg (`character`)\cr #' vector of package names to check. #' @param call (`environment`)\cr #' frame for error messaging. Default is [get_cli_abort_call()]. -#' @param reference_pkg (`string`)\cr +#' @param ref (`string`)\cr #' name of the package the function will search for a minimum required version from. #' @param lib.loc (`path`)\cr #' location of `R` library trees to search through, see [utils::packageDescription()]. #' +#' @details +#' The `ref` argument (`pkg` in `get_pkg_dependencies`) uses `utils::packageName()` as a default, which returns the package in +#' which the current environment or function is run from. The current environment is determined via `parent.frame()`. +#' +#' If, for example, `get_min_version_required("dplyr", ref = utils::packageName())` is run within a `cards` function, and this +#' function is then called within a function of the `cardx` package, the minimum version returned by the +#' `get_min_version_required` call will return the version required by the `cards` package. If run within a test file, +#' `utils::packageName()` returns the package of the current test. Within Roxygen `@examplesIf` calls, `utils::packageName()` will +#' returns the package of the current example. +#' #' @return `is_pkg_installed()` and `check_pkg_installed()` returns a logical or error, #' `get_min_version_required()` returns a data frame with the minimum version required, #' `get_pkg_dependencies()` returns a tibble. @@ -65,18 +74,13 @@ NULL #' @keywords internal #' @noRd check_pkg_installed <- function(pkg, - reference_pkg = "cards", + ref = utils::packageName(), call = get_cli_abort_call()) { - set_cli_abort_call() - - # check inputs --------------------------------------------------------------- - check_not_missing(pkg) - check_class(pkg, cls = "character") - check_string(reference_pkg, allow_empty = TRUE) + if (!is.character(ref) && !is.null(ref)) cli::cli_abort("{.arg ref} must be a string.") # get min version data ------------------------------------------------------- df_pkg_min_version <- - get_min_version_required(pkg = pkg, reference_pkg = reference_pkg, call = call) + get_min_version_required(pkg = pkg, ref = ref) # prompt user to install package --------------------------------------------- rlang::check_installed( @@ -93,18 +97,12 @@ check_pkg_installed <- function(pkg, #' @keywords internal #' @noRd is_pkg_installed <- function(pkg, - reference_pkg = "cards", - call = get_cli_abort_call()) { - set_cli_abort_call() - - # check inputs --------------------------------------------------------------- - check_not_missing(pkg) - check_class(pkg, cls = "character") - check_string(reference_pkg, allow_empty = TRUE) + ref = utils::packageName()) { + if (!is.character(ref) && !is.null(ref)) cli::cli_abort("{.arg ref} must be a string.") # get min version data ------------------------------------------------------- df_pkg_min_version <- - get_min_version_required(pkg = pkg, reference_pkg = reference_pkg, call = call) + get_min_version_required(pkg = pkg, ref = ref) # check installation TRUE/FALSE ---------------------------------------------- rlang::is_installed( @@ -118,17 +116,19 @@ is_pkg_installed <- function(pkg, #' @inheritParams check_pkg_installed #' @keywords internal +#' +#' @param pkg (`string`)\cr +#' name of the package the function will search for dependencies from. +#' #' @noRd -get_pkg_dependencies <- function(reference_pkg = "cards", lib.loc = NULL, call = get_cli_abort_call()) { - set_cli_abort_call() - - check_string(reference_pkg, allow_empty = TRUE, call = call) +get_pkg_dependencies <- function(pkg = utils::packageName(), lib.loc = NULL) { + if (!is.character(pkg) && !is.null(pkg)) cli::cli_abort("{.arg pkg} must be a string.") - if (rlang::is_empty(reference_pkg)) { + if (rlang::is_empty(pkg)) { return(.empty_pkg_deps_df()) } - description <- utils::packageDescription(reference_pkg, lib.loc = lib.loc) |> suppressWarnings() + description <- utils::packageDescription(pkg, lib.loc = lib.loc) |> suppressWarnings() if (identical(description, NA)) { return(.empty_pkg_deps_df()) } @@ -151,7 +151,12 @@ get_pkg_dependencies <- function(reference_pkg = "cards", lib.loc = NULL, call = names_to = "dependency_type", ) |> tidyr::separate_rows("pkg", sep = ",") |> - dplyr::mutate(pkg = str_squish(.data$pkg)) |> + dplyr::mutate( + pkg = trimws( + x = gsub(x = .data$pkg, pattern = "\\s+", replacement = " "), + which = "both", whitespace = "[ \t\r\n]" + ) + ) |> dplyr::filter(!is.na(.data$pkg)) |> tidyr::separate( .data$pkg, @@ -175,16 +180,11 @@ get_pkg_dependencies <- function(reference_pkg = "cards", lib.loc = NULL, call = #' @inheritParams check_pkg_installed #' @keywords internal #' @noRd -get_min_version_required <- function(pkg, reference_pkg = "cards", - lib.loc = NULL, call = get_cli_abort_call()) { - set_cli_abort_call() - - check_not_missing(pkg, call = call) - check_class(pkg, cls = "character", call = call) - check_string(reference_pkg, allow_empty = TRUE, call = call) +get_min_version_required <- function(pkg, ref = utils::packageName(), lib.loc = NULL) { + if (!is.character(ref) && !is.null(ref)) cli::cli_abort("{.arg ref} must be a string.") # if no package reference, return a df with just the pkg names - if (rlang::is_empty(reference_pkg)) { + if (rlang::is_empty(ref)) { return( .empty_pkg_deps_df() |> dplyr::full_join( @@ -197,7 +197,7 @@ get_min_version_required <- function(pkg, reference_pkg = "cards", # get the package_ref deps and subset on requested pkgs, also supplement df with pkgs # that may not be proper deps of the reference package (these pkgs don't have min versions) res <- - get_pkg_dependencies(reference_pkg, lib.loc = lib.loc) |> + get_pkg_dependencies(ref, lib.loc = lib.loc) |> dplyr::filter(.data$pkg %in% .env$pkg) |> dplyr::full_join( dplyr::tibble(pkg = pkg), diff --git a/R/import-standalone-checks.R b/R/import-standalone-checks.R index 0d4c4f7d..182f67b6 100644 --- a/R/import-standalone-checks.R +++ b/R/import-standalone-checks.R @@ -1,9 +1,9 @@ # Standalone file: do not edit by hand -# Source: +# Source: # ---------------------------------------------------------------------- # # --- -# repo: ddsjoberg/standalone +# repo: insightsengineering/standalone # file: standalone-checks.R # last-updated: 2024-05-04 # license: https://unlicense.org @@ -462,5 +462,146 @@ check_formula_list_selector <- function(x, invisible(x) } +#' Check is Integerish +#' +#' @inheritParams check_class +#' @keywords internal +#' @noRd +check_integerish <- function(x, + allow_empty = FALSE, + message = + ifelse( + allow_empty, + "The {.arg {arg_name}} argument must an integer vector or empty.", + "The {.arg {arg_name}} argument must an integer vector." + ), + arg_name = rlang::caller_arg(x), + class = "check_integerish", + call = get_cli_abort_call(), + envir = rlang::current_env()) { + # if empty, skip test + if (isTRUE(allow_empty) && rlang::is_empty(x)) { + return(invisible(x)) + } + + if (!rlang::is_integerish(x)) { + cli::cli_abort(message, class = c(class, "standalone-checks"), call = call, .envir = envir) + } + + invisible(x) +} + +#' Check is Scalar Integerish +#' +#' @inheritParams check_class +#' @keywords internal +#' @noRd +check_scalar_integerish <- function(x, + allow_empty = FALSE, + message = + ifelse( + allow_empty, + "The {.arg {arg_name}} argument must an scalar integer or empty.", + "The {.arg {arg_name}} argument must an scalar integer." + ), + arg_name = rlang::caller_arg(x), + class = "check_integerish", + call = get_cli_abort_call(), + envir = rlang::current_env()) { + # if empty, skip test + if (isTRUE(allow_empty) && rlang::is_empty(x)) { + return(invisible(x)) + } + + if (!rlang::is_scalar_integerish(x)) { + cli::cli_abort(message, class = c(class, "standalone-checks"), call = call, .envir = envir) + } + + invisible(x) +} + + +#' Check for presence of `NA` factor levels in the data +#' +#' @param x (`data.frame`)\cr +#' a data frame +#' @inheritParams check_class +#' @keywords internal +#' @noRd +check_no_na_factor_levels <- function(x, + message = + "Factors with {.val {NA}} levels are not allowed, + which are present in column {.val {variable}}.", + arg_name = rlang::caller_arg(x), + class = "na_factor_levels", + call = get_cli_abort_call(), + envir = rlang::current_env()) { + check_data_frame(x, arg_name = arg_name, class = class, call = call, envir = envir) + + for (variable in names(x)) { + if (is.factor(x[[variable]]) && any(is.na(levels(x[[variable]])))) { + cli::cli_abort(message = message, class = c(class, "standalone-checks"), call = call, .envir = envir) + } + } + + invisible(x) +} + +#' Check for levels attribute exists for factor +#' +#' @param x (`data.frame`)\cr +#' a data frame +#' @inheritParams check_class +#' @keywords internal +#' @noRd +check_factor_has_levels <- function(x, + message = + "Factors with empty {.val levels} attribute are not allowed, + which was identified in column {.val {variable}}.", + arg_name = rlang::caller_arg(x), + class = "na_factor_levels", + call = get_cli_abort_call(), + envir = rlang::current_env()) { + check_data_frame(x, arg_name = arg_name, class = class, call = call, envir = envir) + + for (variable in names(x)) { + if (is.factor(x[[variable]]) && rlang::is_empty(levels(x[[variable]]))) { + cli::cli_abort(message = message, class = c(class, "standalone-checks"), call = call, .envir = envir) + } + } + + invisible(x) +} + + +#' Check is Numeric +#' +#' @inheritParams check_class +#' @keywords internal +#' @noRd +check_numeric <- function(x, + allow_empty = FALSE, + message = + ifelse( + allow_empty, + "The {.arg {arg_name}} argument must be numeric or empty.", + "The {.arg {arg_name}} argument must be numeric." + ), + arg_name = rlang::caller_arg(x), + class = "check_numeric", + call = get_cli_abort_call(), + envir = rlang::current_env()) { + # if empty, skip test + if (isTRUE(allow_empty) && rlang::is_empty(x)) { + return(invisible(x)) + } + + if (!is.numeric(x)) { + cli::cli_abort(message, class = c(class, "standalone-checks"), call = call, .envir = envir) + } + + invisible(x) +} + # nocov end # styler: on diff --git a/R/import-standalone-cli_call_env.R b/R/import-standalone-cli_call_env.R index dc90d64c..971e916a 100644 --- a/R/import-standalone-cli_call_env.R +++ b/R/import-standalone-cli_call_env.R @@ -1,9 +1,9 @@ # Standalone file: do not edit by hand -# Source: +# Source: # ---------------------------------------------------------------------- # # --- -# repo: ddsjoberg/standalone +# repo: insightsengineering/standalone # file: standalone-cli_call_env.R # last-updated: 2024-04-10 # license: https://unlicense.org diff --git a/R/import-standalone-forcats.R b/R/import-standalone-forcats.R index 6da3a6ea..cf2fa4b8 100644 --- a/R/import-standalone-forcats.R +++ b/R/import-standalone-forcats.R @@ -1,8 +1,9 @@ # Standalone file: do not edit by hand -# Source: +# Source: # ---------------------------------------------------------------------- # # --- +# repo: insightsengineering/standalone # file: standalone-forcats.R # last-updated: 2024-06-05 # license: https://unlicense.org diff --git a/R/import-standalone-stringr.R b/R/import-standalone-stringr.R index 9c243995..bbecfec5 100644 --- a/R/import-standalone-stringr.R +++ b/R/import-standalone-stringr.R @@ -1,8 +1,9 @@ # Standalone file: do not edit by hand -# Source: +# Source: # ---------------------------------------------------------------------- # # --- +# repo: insightsengineering/standalone # file: standalone-stringr.R # last-updated: 2024-06-05 # license: https://unlicense.org @@ -29,8 +30,8 @@ str_squish <- function(string, fixed = FALSE, perl = !fixed) { return(string) } -str_remove <- function (string, pattern, fixed = FALSE, perl = !fixed) { - sub (x = string, pattern = pattern, replacement = "", fixed = fixed, perl = perl) +str_remove <- function(string, pattern, fixed = FALSE, perl = !fixed) { + sub(x = string, pattern = pattern, replacement = "", fixed = fixed, perl = perl) } str_remove_all <- function(string, pattern, fixed = FALSE, perl = !fixed) { @@ -57,7 +58,7 @@ str_replace <- function(string, pattern, replacement, fixed = FALSE, perl = !fix sub(x = string, pattern = pattern, replacement = replacement, fixed = fixed, perl = perl) } -str_replace_all <- function (string, pattern, replacement, fixed = FALSE, perl = !fixed){ +str_replace_all <- function(string, pattern, replacement, fixed = FALSE, perl = !fixed) { gsub(x = string, pattern = pattern, replacement = replacement, fixed = fixed, perl = perl) } @@ -88,7 +89,7 @@ word <- function(string, start, end = start, sep = " ", fixed = TRUE, perl = !fi } } -str_sub <- function(string, start = 1L, end = -1L){ +str_sub <- function(string, start = 1L, end = -1L) { str_length <- nchar(string) # Adjust start and end indices for negative values @@ -102,11 +103,11 @@ str_sub <- function(string, start = 1L, end = -1L){ substr(x = string, start = start, stop = end) } -str_sub_all <- function(string, start = 1L, end = -1L){ +str_sub_all <- function(string, start = 1L, end = -1L) { lapply(string, function(x) substr(x, start = start, stop = end)) } -str_pad <- function(string, width, side = c("left", "right", "both"), pad = " ", use_width = TRUE){ +str_pad <- function(string, width, side = c("left", "right", "both"), pad = " ", use_width = TRUE) { side <- match.arg(side, c("left", "right", "both")) if (side == "both") { @@ -131,7 +132,7 @@ str_split <- function(string, pattern, n = Inf, fixed = FALSE, perl = !fixed) { parts <- strsplit(string, split = pattern, fixed = fixed, perl = perl) lapply(parts, function(x) { if (length(x) > n) { - x <- c(x[1:(n-1)], paste(x[n:length(x)], collapse = pattern)) + x <- c(x[1:(n - 1)], paste(x[n:length(x)], collapse = pattern)) } return(x) }) diff --git a/R/import-standalone-tibble.R b/R/import-standalone-tibble.R index f4c7b001..588a0912 100644 --- a/R/import-standalone-tibble.R +++ b/R/import-standalone-tibble.R @@ -1,8 +1,9 @@ # Standalone file: do not edit by hand -# Source: +# Source: # ---------------------------------------------------------------------- # # --- +# repo: insightsengineering/standalone # file: standalone-tibble.R # last-updated: 2024-05-07 # license: https://unlicense.org diff --git a/R/proportion_ci.R b/R/proportion_ci.R index cd5bd427..03aeb9f6 100644 --- a/R/proportion_ci.R +++ b/R/proportion_ci.R @@ -7,7 +7,7 @@ #' @return Confidence interval of a proportion. #' #' @name proportion_ci -#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx")) +#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom")) #' x <- c( #' TRUE, TRUE, TRUE, TRUE, TRUE, #' FALSE, FALSE, FALSE, FALSE, FALSE @@ -75,7 +75,7 @@ proportion_ci_wilson <- function(x, conf.level = 0.95, correct = FALSE) { set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed(pkg = "broom", reference_pkg = "cardx") + check_pkg_installed(pkg = "broom") # check inputs --------------------------------------------------------------- check_not_missing(x) @@ -113,7 +113,7 @@ proportion_ci_clopper_pearson <- function(x, conf.level = 0.95) { set_cli_abort_call() # check installed packages --------------------------------------------------- - check_pkg_installed(pkg = "broom", reference_pkg = "cardx") + check_pkg_installed(pkg = "broom") # check inputs --------------------------------------------------------------- check_not_missing(x) diff --git a/man/ard_aod_wald_test.Rd b/man/ard_aod_wald_test.Rd index d399c6db..ae966a95 100644 --- a/man/ard_aod_wald_test.Rd +++ b/man/ard_aod_wald_test.Rd @@ -26,7 +26,7 @@ Function takes a regression model object and calculates Wald statistical test using \code{\link[aod:wald.test]{aod::wald.test()}}. } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("aod", "broom.helpers"), reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("aod", "broom.helpers")))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} lm(AGE ~ ARM, data = cards::ADSL) |> ard_aod_wald_test() \dontshow{\}) # examplesIf} diff --git a/man/ard_attributes.Rd b/man/ard_attributes.Rd index 6069aae4..8f35ee9b 100644 --- a/man/ard_attributes.Rd +++ b/man/ard_attributes.Rd @@ -33,7 +33,7 @@ the column name will be placed in the label statistic. } } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "survey", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "survey"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} data(api, package = "survey") dclus1 <- survey::svydesign(id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc) diff --git a/man/ard_car_anova.Rd b/man/ard_car_anova.Rd index a7fa67f5..b745e22d 100644 --- a/man/ard_car_anova.Rd +++ b/man/ard_car_anova.Rd @@ -18,7 +18,7 @@ data frame Function takes a regression model object and calculated ANOVA using \code{\link[car:Anova]{car::Anova()}}. } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("broom.helpers", "car", "parameters"), reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("broom.helpers", "car", "parameters")))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} lm(AGE ~ ARM, data = cards::ADSL) |> ard_car_anova() diff --git a/man/ard_car_vif.Rd b/man/ard_car_vif.Rd index 994a3863..7185064c 100644 --- a/man/ard_car_vif.Rd +++ b/man/ard_car_vif.Rd @@ -20,7 +20,7 @@ Function takes a regression model object and returns the variance inflation fact using \code{\link[car:vif]{car::vif()}} and converts it to a ARD structure } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "car", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "car"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} lm(AGE ~ ARM + SEX, data = cards::ADSL) |> ard_car_vif() \dontshow{\}) # examplesIf} diff --git a/man/ard_categorical.survey.design.Rd b/man/ard_categorical.survey.design.Rd index 0040146e..54826bda 100644 --- a/man/ard_categorical.survey.design.Rd +++ b/man/ard_categorical.survey.design.Rd @@ -65,7 +65,7 @@ calculated using \code{survey::svymean()}. The unweighted statistics are calculated with \code{cards::ard_categorical.data.frame()}. } \examples{ -\dontshow{if (cardx:::is_pkg_installed("survey", reference_pkg = "cardx")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (cardx:::is_pkg_installed("survey")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} svy_titanic <- survey::svydesign(~1, data = as.data.frame(Titanic), weights = ~Freq) ard_categorical(svy_titanic, variables = c(Class, Age), by = Survived) diff --git a/man/ard_categorical_ci.Rd b/man/ard_categorical_ci.Rd index 1886cb27..a1148c19 100644 --- a/man/ard_categorical_ci.Rd +++ b/man/ard_categorical_ci.Rd @@ -60,7 +60,7 @@ an ARD data frame Calculate confidence intervals for proportions. } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # compute CI for binary variables ard_categorical_ci(mtcars, variables = c(vs, am), method = "wilson") diff --git a/man/ard_categorical_ci.survey.design.Rd b/man/ard_categorical_ci.survey.design.Rd index fdc9c570..fe30fd5f 100644 --- a/man/ard_categorical_ci.survey.design.Rd +++ b/man/ard_categorical_ci.survey.design.Rd @@ -53,7 +53,7 @@ Confidence intervals for categorical variables calculated via \code{\link[survey:svyciprop]{survey::svyciprop()}}. } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "survey", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "survey"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} data(api, package = "survey") dclus1 <- survey::svydesign(id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc) diff --git a/man/ard_continuous.survey.design.Rd b/man/ard_continuous.survey.design.Rd index 5922db6c..4dce9fa4 100644 --- a/man/ard_continuous.survey.design.Rd +++ b/man/ard_continuous.survey.design.Rd @@ -59,7 +59,7 @@ where 'p##' is are the percentiles and \verb{##} is an integer between 0 and 100 } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "survey", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "survey"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} data(api, package = "survey") dclus1 <- survey::svydesign(id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc) diff --git a/man/ard_continuous_ci.Rd b/man/ard_continuous_ci.Rd index cfa13ee1..21306eaa 100644 --- a/man/ard_continuous_ci.Rd +++ b/man/ard_continuous_ci.Rd @@ -43,7 +43,7 @@ ARD data frame One-sample confidence intervals for continuous variable means and medians. } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} ard_continuous_ci(mtcars, variables = c(mpg, hp), method = "wilcox.test") ard_continuous_ci(mtcars, variables = mpg, by = am, method = "t.test") \dontshow{\}) # examplesIf} diff --git a/man/ard_continuous_ci.survey.design.Rd b/man/ard_continuous_ci.survey.design.Rd index 33524fa5..843da019 100644 --- a/man/ard_continuous_ci.survey.design.Rd +++ b/man/ard_continuous_ci.survey.design.Rd @@ -48,7 +48,7 @@ One-sample confidence intervals for continuous variables' means and medians. Confidence limits are calculated with \code{survey::svymean()} and \code{survey::svyquantile()}. } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "survey", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "survey"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} data(api, package = "survey") dclus1 <- survey::svydesign(id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc) diff --git a/man/ard_dichotomous.survey.design.Rd b/man/ard_dichotomous.survey.design.Rd index fcd88c47..b613247e 100644 --- a/man/ard_dichotomous.survey.design.Rd +++ b/man/ard_dichotomous.survey.design.Rd @@ -65,7 +65,7 @@ an ARD data frame of class 'card' Compute Analysis Results Data (ARD) for dichotomous summary statistics. } \examples{ -\dontshow{if (cardx:::is_pkg_installed("survey", reference_pkg = "cardx")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (cardx:::is_pkg_installed("survey")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} survey::svydesign(ids = ~1, data = mtcars, weights = ~1) |> ard_dichotomous(by = vs, variables = c(cyl, am), value = list(cyl = 4)) \dontshow{\}) # examplesIf} diff --git a/man/ard_effectsize_cohens_d.Rd b/man/ard_effectsize_cohens_d.Rd index 93c907aa..86840003 100644 --- a/man/ard_effectsize_cohens_d.Rd +++ b/man/ard_effectsize_cohens_d.Rd @@ -46,7 +46,7 @@ The data are then passed as \verb{effectsize::cohens_d(x = data_wide[[]], y = data_wide[[]], paired = TRUE, ...)}. } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("effectsize", "parameters"), reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("effectsize", "parameters")))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} cards::ADSL |> dplyr::filter(ARM \%in\% c("Placebo", "Xanomeline High Dose")) |> ard_effectsize_cohens_d(by = ARM, variables = AGE) diff --git a/man/ard_effectsize_hedges_g.Rd b/man/ard_effectsize_hedges_g.Rd index 60c04f1e..a4a4cd58 100644 --- a/man/ard_effectsize_hedges_g.Rd +++ b/man/ard_effectsize_hedges_g.Rd @@ -46,7 +46,7 @@ The data are then passed as \verb{effectsize::hedges_g(x = data_wide[[]], y = data_wide[[]], paired = TRUE, ...)}. } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("effectsize", "parameters"), reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("effectsize", "parameters")))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} cards::ADSL |> dplyr::filter(ARM \%in\% c("Placebo", "Xanomeline High Dose")) |> ard_effectsize_hedges_g(by = ARM, variables = AGE) diff --git a/man/ard_emmeans_mean_difference.Rd b/man/ard_emmeans_mean_difference.Rd index 57a13bbc..926e7872 100644 --- a/man/ard_emmeans_mean_difference.Rd +++ b/man/ard_emmeans_mean_difference.Rd @@ -67,7 +67,7 @@ The arguments \code{data}, \code{formula}, \code{method}, \code{method.args}, \c to construct the regression model via \code{cardx::construct_model()}. } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "emmeans", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "emmeans"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} ard_emmeans_mean_difference( data = mtcars, formula = mpg ~ am + cyl, diff --git a/man/ard_missing.survey.design.Rd b/man/ard_missing.survey.design.Rd index 6bdc78f0..c3f40d83 100644 --- a/man/ard_missing.survey.design.Rd +++ b/man/ard_missing.survey.design.Rd @@ -58,7 +58,7 @@ an ARD data frame of class 'card' Compute Analysis Results Data (ARD) for statistics related to data missingness for survey objects } \examples{ -\dontshow{if (cardx:::is_pkg_installed("survey", reference_pkg = "cardx")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (cardx:::is_pkg_installed("survey")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} svy_titanic <- survey::svydesign(~1, data = as.data.frame(Titanic), weights = ~Freq) ard_missing(svy_titanic, variables = c(Class, Age), by = Survived) diff --git a/man/ard_regression.Rd b/man/ard_regression.Rd index 10b423c6..1a0f1486 100644 --- a/man/ard_regression.Rd +++ b/man/ard_regression.Rd @@ -25,7 +25,7 @@ Function takes a regression model object and converts it to a ARD structure using the \code{broom.helpers} package. } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom.helpers", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom.helpers"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} lm(AGE ~ ARM, data = cards::ADSL) |> ard_regression(add_estimate_to_reference_rows = TRUE) \dontshow{\}) # examplesIf} diff --git a/man/ard_regression_basic.Rd b/man/ard_regression_basic.Rd index 8d500a6b..ecbe9d8e 100644 --- a/man/ard_regression_basic.Rd +++ b/man/ard_regression_basic.Rd @@ -44,7 +44,7 @@ The default arguments used are }\if{html}{\out{}} } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom.helpers", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom.helpers"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} lm(AGE ~ ARM, data = cards::ADSL) |> ard_regression_basic() \dontshow{\}) # examplesIf} diff --git a/man/ard_smd_smd.Rd b/man/ard_smd_smd.Rd index f4e9e060..e057d5ea 100644 --- a/man/ard_smd_smd.Rd +++ b/man/ard_smd_smd.Rd @@ -36,7 +36,7 @@ Additionally, this function add a confidence interval to the SMD when \code{std.error=TRUE}, which the original \code{smd::smd()} does not include. } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "smd", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "smd"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} ard_smd_smd(cards::ADSL, by = SEX, variables = AGE) ard_smd_smd(cards::ADSL, by = SEX, variables = AGEGR1) \dontshow{\}) # examplesIf} diff --git a/man/ard_stats_anova.Rd b/man/ard_stats_anova.Rd index 8334f72b..39e6fe4d 100644 --- a/man/ard_stats_anova.Rd +++ b/man/ard_stats_anova.Rd @@ -78,7 +78,7 @@ e.g. \code{package = 'lme4'} must be specified when \code{method = 'glmer'}. See example below. } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("broom", "withr", "lme4"), reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("broom", "withr", "lme4")))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} anova( lm(mpg ~ am, mtcars), lm(mpg ~ am + hp, mtcars) diff --git a/man/ard_stats_aov.Rd b/man/ard_stats_aov.Rd index 40e29c36..fe03f883 100644 --- a/man/ard_stats_aov.Rd +++ b/man/ard_stats_aov.Rd @@ -23,7 +23,7 @@ Analysis results data for Analysis of Variance. Calculated with \code{stats::aov()} } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("broom.helpers", "parameters"), reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("broom.helpers", "parameters")))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} ard_stats_aov(AGE ~ ARM, data = cards::ADSL) \dontshow{\}) # examplesIf} } diff --git a/man/ard_stats_chisq_test.Rd b/man/ard_stats_chisq_test.Rd index 5dc96cb6..308fefda 100644 --- a/man/ard_stats_chisq_test.Rd +++ b/man/ard_stats_chisq_test.Rd @@ -27,7 +27,7 @@ Analysis results data for Pearson's Chi-squared Test. Calculated with \code{chisq.test(x = data[[variable]], y = data[[by]], ...)} } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} cards::ADSL |> ard_stats_chisq_test(by = "ARM", variables = "AGEGR1") \dontshow{\}) # examplesIf} diff --git a/man/ard_stats_fisher_test.Rd b/man/ard_stats_fisher_test.Rd index 7831e81e..9f0cbce8 100644 --- a/man/ard_stats_fisher_test.Rd +++ b/man/ard_stats_fisher_test.Rd @@ -30,7 +30,7 @@ Analysis results data for Fisher's Exact Test. Calculated with \code{fisher.test(x = data[[variable]], y = data[[by]], ...)} } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} cards::ADSL[1:30, ] |> ard_stats_fisher_test(by = "ARM", variables = "AGEGR1") \dontshow{\}) # examplesIf} diff --git a/man/ard_stats_kruskal_test.Rd b/man/ard_stats_kruskal_test.Rd index e9f4596c..6d625305 100644 --- a/man/ard_stats_kruskal_test.Rd +++ b/man/ard_stats_kruskal_test.Rd @@ -26,7 +26,7 @@ Analysis results data for Kruskal-Wallis Rank Sum Test. Calculated with \code{kruskal.test(data[[variable]], data[[by]], ...)} } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} cards::ADSL |> ard_stats_kruskal_test(by = "ARM", variables = "AGE") \dontshow{\}) # examplesIf} diff --git a/man/ard_stats_mcnemar_test.Rd b/man/ard_stats_mcnemar_test.Rd index e2d09673..72e1c807 100644 --- a/man/ard_stats_mcnemar_test.Rd +++ b/man/ard_stats_mcnemar_test.Rd @@ -42,7 +42,7 @@ The data is passed as \code{stats::mcnemar.test(x = data[[variable]], y = data[[ Please use \code{table(x = data[[variable]], y = data[[by]])} to check the contingency table. } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} cards::ADSL |> ard_stats_mcnemar_test(by = "SEX", variables = "EFFFL") diff --git a/man/ard_stats_mood_test.Rd b/man/ard_stats_mood_test.Rd index 5a06c6c7..ce6033ae 100644 --- a/man/ard_stats_mood_test.Rd +++ b/man/ard_stats_mood_test.Rd @@ -31,7 +31,7 @@ For the \code{ard_stats_mood_test()} function, the data is expected to be one ro The data is passed as \code{mood.test(data[[variable]] ~ data[[by]], ...)}. } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} cards::ADSL |> ard_stats_mood_test(by = "SEX", variables = "AGE") \dontshow{\}) # examplesIf} diff --git a/man/ard_stats_oneway_test.Rd b/man/ard_stats_oneway_test.Rd index 439fb9c3..eceac355 100644 --- a/man/ard_stats_oneway_test.Rd +++ b/man/ard_stats_oneway_test.Rd @@ -25,7 +25,7 @@ Analysis results data for Testing Equal Means in a One-Way Layout. calculated with \code{oneway.test()} } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} ard_stats_oneway_test(AGE ~ ARM, data = cards::ADSL) \dontshow{\}) # examplesIf} } diff --git a/man/ard_stats_poisson_test.Rd b/man/ard_stats_poisson_test.Rd index 6bdcea7a..b79096ce 100644 --- a/man/ard_stats_poisson_test.Rd +++ b/man/ard_stats_poisson_test.Rd @@ -47,7 +47,7 @@ levels, an error will occur. } } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Exact test of rate parameter against null hypothesis cards::ADTTE |> ard_stats_poisson_test(variables = c(CNSR, AVAL)) diff --git a/man/ard_stats_prop_test.Rd b/man/ard_stats_prop_test.Rd index 61bf6179..45ff5a22 100644 --- a/man/ard_stats_prop_test.Rd +++ b/man/ard_stats_prop_test.Rd @@ -29,7 +29,7 @@ ARD data frame Analysis results data for a 2-sample test or proportions using \code{\link[stats:prop.test]{stats::prop.test()}}. } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} mtcars |> ard_stats_prop_test(by = vs, variables = am) \dontshow{\}) # examplesIf} diff --git a/man/ard_stats_t_test.Rd b/man/ard_stats_t_test.Rd index d06172d2..9ce3c921 100644 --- a/man/ard_stats_t_test.Rd +++ b/man/ard_stats_t_test.Rd @@ -45,7 +45,7 @@ The data are then passed as \verb{t.test(x = data_wide[[]], y = data_wide[[]], paired = TRUE, ...)}. } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} cards::ADSL |> dplyr::filter(ARM \%in\% c("Placebo", "Xanomeline High Dose")) |> ard_stats_t_test(by = ARM, variables = c(AGE, BMIBL)) diff --git a/man/ard_stats_t_test_onesample.Rd b/man/ard_stats_t_test_onesample.Rd index 6d36f636..87f17606 100644 --- a/man/ard_stats_t_test_onesample.Rd +++ b/man/ard_stats_t_test_onesample.Rd @@ -36,7 +36,7 @@ Analysis results data for one-sample t-tests. Result may be stratified by including the \code{by} argument. } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} cards::ADSL |> ard_stats_t_test_onesample(by = ARM, variables = AGE) \dontshow{\}) # examplesIf} diff --git a/man/ard_stats_wilcox_test.Rd b/man/ard_stats_wilcox_test.Rd index 86486171..98620357 100644 --- a/man/ard_stats_wilcox_test.Rd +++ b/man/ard_stats_wilcox_test.Rd @@ -45,7 +45,7 @@ The data are then passed as \verb{wilcox.test(x = data_wide[[]], y = data_wide[[]], paired = TRUE, ...)}. } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} cards::ADSL |> dplyr::filter(ARM \%in\% c("Placebo", "Xanomeline High Dose")) |> ard_stats_wilcox_test(by = "ARM", variables = "AGE") diff --git a/man/ard_stats_wilcox_test_onesample.Rd b/man/ard_stats_wilcox_test_onesample.Rd index b0188255..5eae696a 100644 --- a/man/ard_stats_wilcox_test_onesample.Rd +++ b/man/ard_stats_wilcox_test_onesample.Rd @@ -36,7 +36,7 @@ Analysis results data for one-sample Wilcox Rank-sum. Result may be stratified by including the \code{by} argument. } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} cards::ADSL |> ard_stats_wilcox_test_onesample(by = ARM, variables = AGE) \dontshow{\}) # examplesIf} diff --git a/man/ard_survey_svychisq.Rd b/man/ard_survey_svychisq.Rd index 05d66026..a7eebfc8 100644 --- a/man/ard_survey_svychisq.Rd +++ b/man/ard_survey_svychisq.Rd @@ -32,7 +32,7 @@ Analysis results data for survey Chi-Square test using \code{\link[survey:svychi Only two-way comparisons are supported. } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survey", "broom"), reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survey", "broom")))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} data(api, package = "survey") dclus1 <- survey::svydesign(id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc) diff --git a/man/ard_survey_svyranktest.Rd b/man/ard_survey_svyranktest.Rd index e42c1762..f054cfef 100644 --- a/man/ard_survey_svyranktest.Rd +++ b/man/ard_survey_svyranktest.Rd @@ -29,7 +29,7 @@ ARD data frame Analysis results data for survey wilcox test using \code{\link[survey:svyranktest]{survey::svyranktest()}}. } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survey", "broom"), reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survey", "broom")))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} data(api, package = "survey") dclus2 <- survey::svydesign(id = ~ dnum + snum, fpc = ~ fpc1 + fpc2, data = apiclus2) diff --git a/man/ard_survey_svyttest.Rd b/man/ard_survey_svyttest.Rd index b305f491..18831608 100644 --- a/man/ard_survey_svyttest.Rd +++ b/man/ard_survey_svyttest.Rd @@ -29,7 +29,7 @@ ARD data frame Analysis results data for survey t-test using \code{\link[survey:svyttest]{survey::svyttest()}}. } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survey", "broom"), reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survey", "broom")))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} data(api, package = "survey") dclus2 <- survey::svydesign(id = ~ dnum + snum, fpc = ~ fpc1 + fpc2, data = apiclus2) diff --git a/man/ard_survival_survdiff.Rd b/man/ard_survival_survdiff.Rd index 49478e5d..43cbec6c 100644 --- a/man/ard_survival_survdiff.Rd +++ b/man/ard_survival_survdiff.Rd @@ -25,7 +25,7 @@ an ARD data frame of class 'card' Analysis results data for comparison of survival using \code{\link[survival:survdiff]{survival::survdiff()}}. } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survival", "broom", "ggsurvfit"), reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survival", "broom", "ggsurvfit")))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} library(survival) library(ggsurvfit) diff --git a/man/ard_survival_survfit.Rd b/man/ard_survival_survfit.Rd index 04c45a49..e8bf49be 100644 --- a/man/ard_survival_survfit.Rd +++ b/man/ard_survival_survfit.Rd @@ -95,7 +95,7 @@ ard_survival_survfit(x, y, variables, times = 25) } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survival", "broom", "ggsurvfit"), reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survival", "broom", "ggsurvfit")))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} library(survival) library(ggsurvfit) diff --git a/man/ard_survival_survfit_diff.Rd b/man/ard_survival_survfit_diff.Rd index 3a7a7bd7..7b6dc1e9 100644 --- a/man/ard_survival_survfit_diff.Rd +++ b/man/ard_survival_survfit_diff.Rd @@ -24,7 +24,7 @@ Calculate differences in the Kaplan-Meier estimator of survival using the results from \code{\link[survival:survfit]{survival::survfit()}}. } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survival", "ggsurvfit"), reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survival", "ggsurvfit")))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} library(ggsurvfit) library(survival) diff --git a/man/ard_total_n.survey.design.Rd b/man/ard_total_n.survey.design.Rd index 6f9e409d..d5a49b84 100644 --- a/man/ard_total_n.survey.design.Rd +++ b/man/ard_total_n.survey.design.Rd @@ -20,7 +20,7 @@ Returns the total N for a survey object. The placeholder variable name returned in the object is \code{"..ard_total_n.."} } \examples{ -\dontshow{if (cardx:::is_pkg_installed("survey", reference_pkg = "cardx")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (cardx:::is_pkg_installed("survey")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} svy_titanic <- survey::svydesign(~1, data = as.data.frame(Titanic), weights = ~Freq) ard_total_n(svy_titanic) diff --git a/man/construction_helpers.Rd b/man/construction_helpers.Rd index e71faeec..f238e38d 100644 --- a/man/construction_helpers.Rd +++ b/man/construction_helpers.Rd @@ -108,7 +108,7 @@ names that contain a space are wrapped in backticks. } } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("withr", "lme4", "broom.helpers", "broom.mixed"), reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("withr", "lme4", "broom.helpers", "broom.mixed")))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} construct_model( data = mtcars, formula = am ~ mpg + (1 | vs), diff --git a/man/dot-format_cohens_d_results.Rd b/man/dot-format_cohens_d_results.Rd index 20edfa95..949f76cc 100644 --- a/man/dot-format_cohens_d_results.Rd +++ b/man/dot-format_cohens_d_results.Rd @@ -28,7 +28,7 @@ ARD data frame Convert Cohen's D Test to ARD } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("effectsize", "parameters"), reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("effectsize", "parameters")))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} cardx:::.format_cohens_d_results( by = "ARM", variable = "AGE", diff --git a/man/dot-format_hedges_g_results.Rd b/man/dot-format_hedges_g_results.Rd index d22e5b76..703a83c2 100644 --- a/man/dot-format_hedges_g_results.Rd +++ b/man/dot-format_hedges_g_results.Rd @@ -28,7 +28,7 @@ ARD data frame Convert Hedge's G Test to ARD } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("effectsize", "parameters"), reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("effectsize", "parameters")))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} cardx:::.format_hedges_g_results( by = "ARM", variable = "AGE", diff --git a/man/dot-format_mcnemartest_results.Rd b/man/dot-format_mcnemartest_results.Rd index a373a3f6..cc3258ce 100644 --- a/man/dot-format_mcnemartest_results.Rd +++ b/man/dot-format_mcnemartest_results.Rd @@ -24,7 +24,7 @@ ARD data frame Convert McNemar's test to ARD } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} cardx:::.format_mcnemartest_results( by = "ARM", variable = "AGE", diff --git a/man/dot-format_moodtest_results.Rd b/man/dot-format_moodtest_results.Rd index a3be12b1..098ff20a 100644 --- a/man/dot-format_moodtest_results.Rd +++ b/man/dot-format_moodtest_results.Rd @@ -24,7 +24,7 @@ ARD data frame Convert mood test results to ARD } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} cardx:::.format_moodtest_results( by = "SEX", variable = "AGE", diff --git a/man/dot-format_poissontest_results.Rd b/man/dot-format_poissontest_results.Rd index 19a451d8..22a6a616 100644 --- a/man/dot-format_poissontest_results.Rd +++ b/man/dot-format_poissontest_results.Rd @@ -24,7 +24,7 @@ ARD data frame Convert Poisson test to ARD } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} cardx:::.format_poissontest_results( by = "ARM", variables = c("CNSR", "AVAL"), diff --git a/man/dot-format_survfit_results.Rd b/man/dot-format_survfit_results.Rd index 0e52d8fe..f54e8f3b 100644 --- a/man/dot-format_survfit_results.Rd +++ b/man/dot-format_survfit_results.Rd @@ -13,7 +13,7 @@ an ARD data frame of class 'card' Convert Tidied Survival Fit to ARD } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survival", "broom"), reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survival", "broom")))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} cardx:::.format_survfit_results( broom::tidy(survival::survfit(survival::Surv(AVAL, CNSR) ~ TRTA, cards::ADTTE)) ) diff --git a/man/dot-format_ttest_results.Rd b/man/dot-format_ttest_results.Rd index 5896cc6d..13811218 100644 --- a/man/dot-format_ttest_results.Rd +++ b/man/dot-format_ttest_results.Rd @@ -27,7 +27,7 @@ ARD data frame Convert t-test to ARD } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} cardx:::.format_ttest_results( by = "ARM", variable = "AGE", diff --git a/man/dot-format_wilcoxtest_results.Rd b/man/dot-format_wilcoxtest_results.Rd index ad4cbd2f..9f1ac8f3 100644 --- a/man/dot-format_wilcoxtest_results.Rd +++ b/man/dot-format_wilcoxtest_results.Rd @@ -26,7 +26,7 @@ ARD data frame Convert Wilcoxon test to ARD } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Pre-processing ADSL to have grouping factor (ARM here) with 2 levels ADSL <- cards::ADSL |> dplyr::filter(ARM \%in\% c("Placebo", "Xanomeline High Dose")) |> diff --git a/man/dot-process_survfit_probs.Rd b/man/dot-process_survfit_probs.Rd index c85cf690..32b4ddcc 100644 --- a/man/dot-process_survfit_probs.Rd +++ b/man/dot-process_survfit_probs.Rd @@ -20,7 +20,7 @@ a \code{tibble} Process Survival Fit For Quantile Estimates } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "survival", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "survival"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} survival::survfit(survival::Surv(AVAL, CNSR) ~ TRTA, cards::ADTTE) |> cardx:::.process_survfit_probs(probs = c(0.25, 0.75)) \dontshow{\}) # examplesIf} diff --git a/man/dot-process_survfit_time.Rd b/man/dot-process_survfit_time.Rd index 3aa276a7..2a7f5622 100644 --- a/man/dot-process_survfit_time.Rd +++ b/man/dot-process_survfit_time.Rd @@ -33,7 +33,7 @@ a \code{tibble} Process Survival Fit For Time Estimates } \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survival", "broom"), reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survival", "broom")))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} survival::survfit(survival::Surv(AVAL, CNSR) ~ TRTA, cards::ADTTE) |> cardx:::.process_survfit_time(times = c(60, 180), type = "risk") \dontshow{\}) # examplesIf} diff --git a/man/proportion_ci.Rd b/man/proportion_ci.Rd index f2a5d903..49bf237a 100644 --- a/man/proportion_ci.Rd +++ b/man/proportion_ci.Rd @@ -106,7 +106,7 @@ z_{\alpha/2} \sqrt{\frac{\hat{p}_j(1 - \hat{p}_j)}{n_j} + }} \examples{ -\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom"))) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} x <- c( TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE diff --git a/tests/testthat/test-ard_aod_wald_test.R b/tests/testthat/test-ard_aod_wald_test.R index 10095906..0257ce82 100644 --- a/tests/testthat/test-ard_aod_wald_test.R +++ b/tests/testthat/test-ard_aod_wald_test.R @@ -1,4 +1,4 @@ -skip_if_not(do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("aod", "broom.helpers"), reference_pkg = "cardx"))) +skip_if_not(do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("aod", "broom.helpers")))) test_that("ard_aod_wald_test() works", { # works for a generic case diff --git a/tests/testthat/test-ard_attributes.survey.design.R b/tests/testthat/test-ard_attributes.survey.design.R index f1b783d4..6030ee9b 100644 --- a/tests/testthat/test-ard_attributes.survey.design.R +++ b/tests/testthat/test-ard_attributes.survey.design.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed(c("survey", "withr"), reference_pkg = "cardx")) +skip_if_not(is_pkg_installed(c("survey", "withr"))) test_that("ard_attributes.survey.design() works", { withr::local_options(list(width = 120)) diff --git a/tests/testthat/test-ard_car_anova.R b/tests/testthat/test-ard_car_anova.R index 3c61061f..cbf4efaf 100644 --- a/tests/testthat/test-ard_car_anova.R +++ b/tests/testthat/test-ard_car_anova.R @@ -1,5 +1,5 @@ skip_if_not( - is_pkg_installed(c("broom.helpers", "car", "parameters"), reference_pkg = "cardx") + is_pkg_installed(c("broom.helpers", "car", "parameters")) ) test_that("ard_car_anova() works", { diff --git a/tests/testthat/test-ard_car_vif.R b/tests/testthat/test-ard_car_vif.R index 2220b284..b8336d80 100644 --- a/tests/testthat/test-ard_car_vif.R +++ b/tests/testthat/test-ard_car_vif.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed("car", reference_pkg = "cardx")) +skip_if_not(is_pkg_installed("car")) test_that("ard_car_vif() works", { expect_snapshot( diff --git a/tests/testthat/test-ard_categorical.survey.design.R b/tests/testthat/test-ard_categorical.survey.design.R index 52e54981..21655a27 100644 --- a/tests/testthat/test-ard_categorical.survey.design.R +++ b/tests/testthat/test-ard_categorical.survey.design.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed("survey", reference_pkg = "cardx")) +skip_if_not(is_pkg_installed("survey")) # Test survey.design working (2x3) test_that("ard_categorical.survey.design() works", { diff --git a/tests/testthat/test-ard_categorical_ci.survey.design.R b/tests/testthat/test-ard_categorical_ci.survey.design.R index f1829aa3..eb6be0a8 100644 --- a/tests/testthat/test-ard_categorical_ci.survey.design.R +++ b/tests/testthat/test-ard_categorical_ci.survey.design.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed("survey", reference_pkg = "cards")) +skip_if_not(is_pkg_installed("survey")) data(api, package = "survey") dclus1 <- survey::svydesign(id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc) diff --git a/tests/testthat/test-ard_continuous.survey.design.R b/tests/testthat/test-ard_continuous.survey.design.R index 110deebb..ecb87303 100644 --- a/tests/testthat/test-ard_continuous.survey.design.R +++ b/tests/testthat/test-ard_continuous.survey.design.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed("survey", reference_pkg = "cardx")) +skip_if_not(is_pkg_installed("survey")) test_that("unstratified ard_continuous.survey.design() works", { data(api, package = "survey") diff --git a/tests/testthat/test-ard_continuous_ci.data.frame.R b/tests/testthat/test-ard_continuous_ci.data.frame.R index e170104d..27c7b232 100644 --- a/tests/testthat/test-ard_continuous_ci.data.frame.R +++ b/tests/testthat/test-ard_continuous_ci.data.frame.R @@ -1,5 +1,5 @@ test_that("ard_continuous_ci.data.frame(method = 't.test')", { - skip_if_not(is_pkg_installed("broom", reference_pkg = "cardx")) + skip_if_not(is_pkg_installed("broom")) expect_equal( ard_continuous_ci( @@ -17,7 +17,7 @@ test_that("ard_continuous_ci.data.frame(method = 't.test')", { }) test_that("ard_continuous_ci.data.frame(method = 'wilcox.test')", { - skip_if_not(is_pkg_installed("broom", reference_pkg = "cardx")) + skip_if_not(is_pkg_installed("broom")) expect_equal( ard_continuous_ci( mtcars, @@ -35,7 +35,7 @@ test_that("ard_continuous_ci.data.frame(method = 'wilcox.test')", { }) test_that("ard_continuous_ci.data.frame() follows ard structure", { - skip_if_not(is_pkg_installed("broom", reference_pkg = "cardx")) + skip_if_not(is_pkg_installed("broom")) expect_silent( ard_continuous_ci( diff --git a/tests/testthat/test-ard_continuous_ci.survey.design.R b/tests/testthat/test-ard_continuous_ci.survey.design.R index 1202538f..46770120 100644 --- a/tests/testthat/test-ard_continuous_ci.survey.design.R +++ b/tests/testthat/test-ard_continuous_ci.survey.design.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed("survey", reference_pkg = "cards")) +skip_if_not(is_pkg_installed("survey")) data(api, package = "survey") dclus1 <- survey::svydesign(id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc) diff --git a/tests/testthat/test-ard_dichotomous.survey.design.R b/tests/testthat/test-ard_dichotomous.survey.design.R index 0690dc6b..ce71bc22 100644 --- a/tests/testthat/test-ard_dichotomous.survey.design.R +++ b/tests/testthat/test-ard_dichotomous.survey.design.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed("survey", reference_pkg = "cardx")) +skip_if_not(is_pkg_installed("survey")) # Test survey.design works test_that("ard_dichotomous.survey.design() works", { diff --git a/tests/testthat/test-ard_effectsize_cohens_d.R b/tests/testthat/test-ard_effectsize_cohens_d.R index e1b826fb..bd874d8b 100644 --- a/tests/testthat/test-ard_effectsize_cohens_d.R +++ b/tests/testthat/test-ard_effectsize_cohens_d.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed(c("effectsize", "parameters"), reference_pkg = "cardx")) +skip_if_not(is_pkg_installed(c("effectsize", "parameters"))) test_that("ard_effectsize_cohens_d() works", { # there were some discrepancies in the 7th decimal place on one system diff --git a/tests/testthat/test-ard_effectsize_hedges_g.R b/tests/testthat/test-ard_effectsize_hedges_g.R index c908ddb2..a6c8bd35 100644 --- a/tests/testthat/test-ard_effectsize_hedges_g.R +++ b/tests/testthat/test-ard_effectsize_hedges_g.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed(c("effectsize", "parameters"), reference_pkg = "cardx")) +skip_if_not(is_pkg_installed(c("effectsize", "parameters"))) test_that("ard_effectsize_hedges_g() works", { expect_error( diff --git a/tests/testthat/test-ard_emmeans_mean_difference.R b/tests/testthat/test-ard_emmeans_mean_difference.R index 81b07a77..12cd2127 100644 --- a/tests/testthat/test-ard_emmeans_mean_difference.R +++ b/tests/testthat/test-ard_emmeans_mean_difference.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed(c("emmeans", "survey", "lme4"), reference_pkg = "cardx")) +skip_if_not(is_pkg_installed(c("emmeans", "survey", "lme4"))) test_that("ard_emmeans_mean_difference() works", { expect_error( diff --git a/tests/testthat/test-ard_missing.survey.design.R b/tests/testthat/test-ard_missing.survey.design.R index e012238a..53dedda9 100644 --- a/tests/testthat/test-ard_missing.survey.design.R +++ b/tests/testthat/test-ard_missing.survey.design.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed("survey", reference_pkg = "cardx")) +skip_if_not(is_pkg_installed("survey")) # Test survey.design working (2x3) test_that("ard_missing.survey.design() works", { diff --git a/tests/testthat/test-ard_proportion_ci.R b/tests/testthat/test-ard_proportion_ci.R index 4d58c814..06bb22b1 100644 --- a/tests/testthat/test-ard_proportion_ci.R +++ b/tests/testthat/test-ard_proportion_ci.R @@ -1,4 +1,4 @@ -skip_if_not(do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))) +skip_if_not(do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom"))) test_that("ard_categorical_ci() works", { # testing the easy methods together for binary variables diff --git a/tests/testthat/test-ard_regression.R b/tests/testthat/test-ard_regression.R index d1d8ca46..90a4db6e 100644 --- a/tests/testthat/test-ard_regression.R +++ b/tests/testthat/test-ard_regression.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed(pkg = "broom.helpers", reference_pkg = "cardx")) +skip_if_not(is_pkg_installed(pkg = "broom.helpers")) test_that("ard_regression() works", { withr::local_options(list(width = 90)) @@ -24,7 +24,7 @@ test_that("ard_regression() works", { }) test_that("ard_regression() works specifying custom tidier", { - skip_if_not(is_pkg_installed(pkg = c("lme4", "broom.mixed"), reference_pkg = "cardx")) + skip_if_not(is_pkg_installed(pkg = c("lme4", "broom.mixed"))) withr::local_options(list(width = 90)) expect_snapshot( @@ -44,7 +44,7 @@ test_that("ard_regression() does not produce `variable_level` column where not a }) test_that("ard_regression() warnings and errors return correctly", { - skip_if_not(is_pkg_installed(pkg = "parameters", reference_pkg = "cardx")) + skip_if_not(is_pkg_installed(pkg = "parameters")) # constructed a model where broom.helpers fails, # fall back method uses parameters which returns different messaging. mod <- lm(AGE ~ ARM, data = cards::ADSL) diff --git a/tests/testthat/test-ard_regression_basic.R b/tests/testthat/test-ard_regression_basic.R index cd6ea499..8f1409e5 100644 --- a/tests/testthat/test-ard_regression_basic.R +++ b/tests/testthat/test-ard_regression_basic.R @@ -1,4 +1,4 @@ -skip_if_not(do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom.helpers", reference_pkg = "cardx"))) +skip_if_not(do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom.helpers"))) test_that("ard_regression_basic() works", { withr::local_options(list(width = 100)) diff --git a/tests/testthat/test-ard_smd_smd.R b/tests/testthat/test-ard_smd_smd.R index 924d0f3b..e57e68d9 100644 --- a/tests/testthat/test-ard_smd_smd.R +++ b/tests/testthat/test-ard_smd_smd.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed("smd", reference_pkg = "cardx")) +skip_if_not(is_pkg_installed("smd")) test_that("ard_smd_smd() works", { expect_error( @@ -30,7 +30,7 @@ test_that("ard_smd_smd() works", { }) test_that("ard_smd() works with survey data", { - skip_if_not(is_pkg_installed("survey", reference_pkg = "cardx")) + skip_if_not(is_pkg_installed("survey")) data(api, package = "survey") dclus1 <- survey::svydesign(id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc) diff --git a/tests/testthat/test-ard_stats_anova.R b/tests/testthat/test-ard_stats_anova.R index 4342f79d..336c2937 100644 --- a/tests/testthat/test-ard_stats_anova.R +++ b/tests/testthat/test-ard_stats_anova.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed(c("broom", "withr", "lme4", "survival", "geepack"), reference_pkg = "cardx")) +skip_if_not(is_pkg_installed(c("broom", "withr", "lme4", "survival", "geepack"))) test_that("ard_stats_anova.anova() works", { expect_equal( diff --git a/tests/testthat/test-ard_stats_aov.R b/tests/testthat/test-ard_stats_aov.R index c06b46f4..7ef0486b 100644 --- a/tests/testthat/test-ard_stats_aov.R +++ b/tests/testthat/test-ard_stats_aov.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed(c("broom.helpers", "parameters"), reference_pkg = "cardx")) +skip_if_not(is_pkg_installed(c("broom.helpers", "parameters"))) test_that("ard_aov() works", { expect_error( diff --git a/tests/testthat/test-ard_stats_chisq_test.R b/tests/testthat/test-ard_stats_chisq_test.R index 66784075..692a84e2 100644 --- a/tests/testthat/test-ard_stats_chisq_test.R +++ b/tests/testthat/test-ard_stats_chisq_test.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed("broom", reference_pkg = "cardx")) +skip_if_not(is_pkg_installed("broom")) test_that("ard_stats_chisq_test() works", { expect_error( diff --git a/tests/testthat/test-ard_stats_fisher_test.R b/tests/testthat/test-ard_stats_fisher_test.R index c0ad682a..7c8fcf2d 100644 --- a/tests/testthat/test-ard_stats_fisher_test.R +++ b/tests/testthat/test-ard_stats_fisher_test.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed("broom", reference_pkg = "cardx")) +skip_if_not(is_pkg_installed("broom")) test_that("ard_stats_fisher_test() works", { expect_error( diff --git a/tests/testthat/test-ard_stats_kruskal_test.R b/tests/testthat/test-ard_stats_kruskal_test.R index bbc50b97..743f4eba 100644 --- a/tests/testthat/test-ard_stats_kruskal_test.R +++ b/tests/testthat/test-ard_stats_kruskal_test.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed("broom", reference_pkg = "cardx")) +skip_if_not(is_pkg_installed("broom")) test_that("ard_stats_kruskal_test() works", { expect_error( diff --git a/tests/testthat/test-ard_stats_mcnemar_test.R b/tests/testthat/test-ard_stats_mcnemar_test.R index 7ae17ae4..7d5c1462 100644 --- a/tests/testthat/test-ard_stats_mcnemar_test.R +++ b/tests/testthat/test-ard_stats_mcnemar_test.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed(c("broom", "withr"), reference_pkg = "cardx")) +skip_if_not(is_pkg_installed(c("broom", "withr"))) test_that("ard_stats_mcnemar_test() works", { expect_error( diff --git a/tests/testthat/test-ard_stats_mood_test.R b/tests/testthat/test-ard_stats_mood_test.R index 2cb0e083..a57f30ca 100644 --- a/tests/testthat/test-ard_stats_mood_test.R +++ b/tests/testthat/test-ard_stats_mood_test.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed("broom", reference_pkg = "cardx")) +skip_if_not(is_pkg_installed("broom")) test_that("ard_stats_mood_test() works", { expect_error( diff --git a/tests/testthat/test-ard_stats_oneway_test.R b/tests/testthat/test-ard_stats_oneway_test.R index 00126656..a9c5897f 100644 --- a/tests/testthat/test-ard_stats_oneway_test.R +++ b/tests/testthat/test-ard_stats_oneway_test.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed("broom", reference_pkg = "cardx")) +skip_if_not(is_pkg_installed("broom")) test_that("ard_stats_oneway_test() works", { expect_error( diff --git a/tests/testthat/test-ard_stats_poisson_test.R b/tests/testthat/test-ard_stats_poisson_test.R index 0a083dd9..0c7aeb4f 100644 --- a/tests/testthat/test-ard_stats_poisson_test.R +++ b/tests/testthat/test-ard_stats_poisson_test.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed("broom", reference_pkg = "cardx")) +skip_if_not(is_pkg_installed("broom")) test_that("ard_stats_poisson_test() works for one sample tests", { # Default values work diff --git a/tests/testthat/test-ard_stats_prop_test.R b/tests/testthat/test-ard_stats_prop_test.R index 73d632c6..ee2fc8df 100644 --- a/tests/testthat/test-ard_stats_prop_test.R +++ b/tests/testthat/test-ard_stats_prop_test.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed("broom", reference_pkg = "cardx")) +skip_if_not(is_pkg_installed("broom")) test_that("ard_stats_prop_test() works", { expect_error( diff --git a/tests/testthat/test-ard_stats_t_test.R b/tests/testthat/test-ard_stats_t_test.R index 7aedd3db..5f438865 100644 --- a/tests/testthat/test-ard_stats_t_test.R +++ b/tests/testthat/test-ard_stats_t_test.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed("broom", reference_pkg = "cardx")) +skip_if_not(is_pkg_installed("broom")) test_that("ard_stats_t_test() works", { # One Sample t-test works diff --git a/tests/testthat/test-ard_stats_t_test_onesample.R b/tests/testthat/test-ard_stats_t_test_onesample.R index fa8949a8..21d34b33 100644 --- a/tests/testthat/test-ard_stats_t_test_onesample.R +++ b/tests/testthat/test-ard_stats_t_test_onesample.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed("broom", reference_pkg = "cardx")) +skip_if_not(is_pkg_installed("broom")) test_that("ard_stats_t_test_onesample() works", { # first calculate an object to test against diff --git a/tests/testthat/test-ard_stats_wilcox_test.R b/tests/testthat/test-ard_stats_wilcox_test.R index 322a4ac5..30122b8e 100644 --- a/tests/testthat/test-ard_stats_wilcox_test.R +++ b/tests/testthat/test-ard_stats_wilcox_test.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed("broom", reference_pkg = "cardx")) +skip_if_not(is_pkg_installed("broom")) test_that("ard_stats_wilcox_test() works", { # One Sample Wilcox works diff --git a/tests/testthat/test-ard_stats_wilcox_test_onesample.R b/tests/testthat/test-ard_stats_wilcox_test_onesample.R index 3247e8a3..1065e963 100644 --- a/tests/testthat/test-ard_stats_wilcox_test_onesample.R +++ b/tests/testthat/test-ard_stats_wilcox_test_onesample.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed("broom", reference_pkg = "cardx")) +skip_if_not(is_pkg_installed("broom")) test_that("ard_stats_wilcox_test_onesample() works", { # first calculate an object to test against diff --git a/tests/testthat/test-ard_survey_svychisq.R b/tests/testthat/test-ard_survey_svychisq.R index 86ed81e4..11f15738 100644 --- a/tests/testthat/test-ard_survey_svychisq.R +++ b/tests/testthat/test-ard_survey_svychisq.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed(c("survey", "broom"), reference_pkg = "cardx")) +skip_if_not(is_pkg_installed(c("survey", "broom"))) test_that("ard_survey_svychisq() works", { data(api, package = "survey") diff --git a/tests/testthat/test-ard_survey_svyranktest.R b/tests/testthat/test-ard_survey_svyranktest.R index 9df43c18..76ad8924 100644 --- a/tests/testthat/test-ard_survey_svyranktest.R +++ b/tests/testthat/test-ard_survey_svyranktest.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed(c("survey", "broom"), reference_pkg = "cardx")) +skip_if_not(is_pkg_installed(c("survey", "broom"))) test_that("ard_survey_svyranktest() works", { data(api, package = "survey") diff --git a/tests/testthat/test-ard_survey_svyttest.R b/tests/testthat/test-ard_survey_svyttest.R index ece44b7e..d42d9f60 100644 --- a/tests/testthat/test-ard_survey_svyttest.R +++ b/tests/testthat/test-ard_survey_svyttest.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed(c("survey", "broom"), reference_pkg = "cardx")) +skip_if_not(is_pkg_installed(c("survey", "broom"))) test_that("ard_survey_svyttest() works", { data(api, package = "survey") diff --git a/tests/testthat/test-ard_survival_survdiff.R b/tests/testthat/test-ard_survival_survdiff.R index 6dd8eb13..ceba2be1 100644 --- a/tests/testthat/test-ard_survival_survdiff.R +++ b/tests/testthat/test-ard_survival_survdiff.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed(c("survival", "broom"), reference_pkg = "cardx")) +skip_if_not(is_pkg_installed(c("survival", "broom"))) test_that("ard_survival_survdiff() works", { # Log-rank test ---- diff --git a/tests/testthat/test-ard_survival_survfit.R b/tests/testthat/test-ard_survival_survfit.R index b69537e4..4732e2a7 100644 --- a/tests/testthat/test-ard_survival_survfit.R +++ b/tests/testthat/test-ard_survival_survfit.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed(c("survival", "broom"), reference_pkg = "cardx")) +skip_if_not(is_pkg_installed(c("survival", "broom"))) test_that("ard_survival_survfit() works with times provided", { expect_snapshot( diff --git a/tests/testthat/test-ard_survival_survfit_diff.R b/tests/testthat/test-ard_survival_survfit_diff.R index f9914687..64ec1cc2 100644 --- a/tests/testthat/test-ard_survival_survfit_diff.R +++ b/tests/testthat/test-ard_survival_survfit_diff.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed(c("survival", "broom"), reference_pkg = "cardx")) +skip_if_not(is_pkg_installed(c("survival", "broom"))) test_that("ard_survival_survfit_diff() works", { withr::local_package("survival") diff --git a/tests/testthat/test-ard_total_n.survey.design.R b/tests/testthat/test-ard_total_n.survey.design.R index ed9e0b28..8a40f386 100644 --- a/tests/testthat/test-ard_total_n.survey.design.R +++ b/tests/testthat/test-ard_total_n.survey.design.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed("survey", reference_pkg = "cardx")) +skip_if_not(is_pkg_installed("survey")) test_that("ard_total_n.survey.design() works", { expect_snapshot( diff --git a/tests/testthat/test-construction_helpers.R b/tests/testthat/test-construction_helpers.R index c919d302..955e6866 100644 --- a/tests/testthat/test-construction_helpers.R +++ b/tests/testthat/test-construction_helpers.R @@ -1,4 +1,4 @@ -skip_if_not(is_pkg_installed(c("broom.helpers", "withr", "survey", "survival"), reference_pkg = "cardx")) +skip_if_not(is_pkg_installed(c("broom.helpers", "withr", "survey", "survival"))) test_that("construct_model() works", { expect_snapshot( diff --git a/tests/testthat/test-proportion_ci.R b/tests/testthat/test-proportion_ci.R index 0129a5b9..19668824 100644 --- a/tests/testthat/test-proportion_ci.R +++ b/tests/testthat/test-proportion_ci.R @@ -1,4 +1,4 @@ -skip_if_not(do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))) +skip_if_not(do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom"))) test_that("check the proportion_ci_*() functions work", { # setting vectors to test