From 108edfd5461c313ee04da91699afe16d79ef9456 Mon Sep 17 00:00:00 2001 From: Zelos Zhu Date: Thu, 2 May 2024 17:40:32 +0000 Subject: [PATCH 1/3] add appropriate argument to functions --- R/ard_effectsize_cohens_d.R | 10 ++++++---- R/ard_effectsize_hedges_g.R | 10 ++++++---- R/ard_stats_fisher_test.R | 6 ++++-- R/ard_stats_prop_test.R | 5 ++++- R/ard_stats_t_test.R | 10 ++++++---- R/ard_stats_wilcox_test.R | 10 ++++++---- man/ard_effectsize_cohens_d.Rd | 7 +++++-- man/ard_effectsize_hedges_g.Rd | 7 +++++-- man/ard_stats_fisher_test.Rd | 5 ++++- man/ard_stats_prop_test.Rd | 5 ++++- man/ard_stats_t_test.Rd | 7 +++++-- man/ard_stats_wilcox_test.Rd | 7 +++++-- man/dot-format_cohens_d_results.Rd | 2 +- man/dot-format_hedges_g_results.Rd | 2 +- 14 files changed, 62 insertions(+), 31 deletions(-) diff --git a/R/ard_effectsize_cohens_d.R b/R/ard_effectsize_cohens_d.R index b0c51df9b..156a5a9ee 100644 --- a/R/ard_effectsize_cohens_d.R +++ b/R/ard_effectsize_cohens_d.R @@ -13,6 +13,8 @@ #' Independent tests will be run for each variable. #' @param id ([`tidy-select`][dplyr::dplyr_tidy_select])\cr #' column name of the subject or participant ID +#' @param conf.level (scalar `numeric`)\cr +#' confidence level for confidence interval. Default is `0.95`. #' @param ... arguments passed to `effectsize::cohens_d(...)` #' #' @return ARD data frame @@ -46,7 +48,7 @@ NULL #' @rdname ard_effectsize_cohens_d #' @export -ard_effectsize_cohens_d <- function(data, by, variables, ...) { +ard_effectsize_cohens_d <- function(data, by, variables, conf.level = 0.95, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- @@ -75,7 +77,7 @@ ard_effectsize_cohens_d <- function(data, by, variables, ...) { variable = variable, lst_tidy = cards::eval_capture_conditions( - effectsize::cohens_d(data[[variable]] ~ data[[by]], data = data, paired = FALSE, ...) |> + effectsize::cohens_d(data[[variable]] ~ data[[by]], data = data, paired = FALSE, ci = conf.level, ...) |> parameters::standardize_names(style = "broom") ), paired = FALSE, @@ -89,7 +91,7 @@ ard_effectsize_cohens_d <- function(data, by, variables, ...) { #' @rdname ard_effectsize_cohens_d #' @export -ard_effectsize_paired_cohens_d <- function(data, by, variables, id, ...) { +ard_effectsize_paired_cohens_d <- function(data, by, variables, id, conf.level = 0.95, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- @@ -123,7 +125,7 @@ ard_effectsize_paired_cohens_d <- function(data, by, variables, id, ...) { # adding this reshape inside the eval, so if there is an error it's captured in the ARD object data_wide <- .paired_data_pivot_wider(data, by = by, variable = variable, id = id) # perform paired cohen's d test - effectsize::cohens_d(x = data_wide[["by1"]], y = data_wide[["by2"]], paired = TRUE, ...) |> + effectsize::cohens_d(x = data_wide[["by1"]], y = data_wide[["by2"]], paired = TRUE, ci = conf.level, ...) |> parameters::standardize_names(style = "broom") }), paired = TRUE, diff --git a/R/ard_effectsize_hedges_g.R b/R/ard_effectsize_hedges_g.R index 3cdcf3a8d..d6575921d 100644 --- a/R/ard_effectsize_hedges_g.R +++ b/R/ard_effectsize_hedges_g.R @@ -13,6 +13,8 @@ #' tests will be run for each variable #' @param id ([`tidy-select`][dplyr::dplyr_tidy_select])\cr #' column name of the subject or participant ID +#' @param conf.level (scalar `numeric`)\cr +#' confidence level for confidence interval. Default is `0.95`. #' @param ... arguments passed to `effectsize::hedges_g(...)` #' #' @return ARD data frame @@ -46,7 +48,7 @@ NULL #' @rdname ard_effectsize_hedges_g #' @export -ard_effectsize_hedges_g <- function(data, by, variables, ...) { +ard_effectsize_hedges_g <- function(data, by, variables, conf.level = 0.95, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- @@ -79,7 +81,7 @@ ard_effectsize_hedges_g <- function(data, by, variables, ...) { # Will also need to remove `hedges_g` from globalVariables() withr::with_namespace( package = "effectsize", - code = hedges_g(data[[variable]] ~ data[[by]], paired = FALSE, ...) + code = hedges_g(data[[variable]] ~ data[[by]], paired = FALSE, ci = conf.level, ...) ) |> parameters::standardize_names(style = "broom") ), @@ -93,7 +95,7 @@ ard_effectsize_hedges_g <- function(data, by, variables, ...) { #' @rdname ard_effectsize_hedges_g #' @export -ard_effectsize_paired_hedges_g <- function(data, by, variables, id, ...) { +ard_effectsize_paired_hedges_g <- function(data, by, variables, id, conf.level = 0.95, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- @@ -129,7 +131,7 @@ ard_effectsize_paired_hedges_g <- function(data, by, variables, id, ...) { # perform paired cohen's d test withr::with_namespace( package = "effectsize", - code = hedges_g(x = data_wide[["by1"]], y = data_wide[["by2"]], paired = TRUE, ...) + code = hedges_g(x = data_wide[["by1"]], y = data_wide[["by2"]], paired = TRUE, ci = conf.level, ...) ) |> parameters::standardize_names(style = "broom") }), diff --git a/R/ard_stats_fisher_test.R b/R/ard_stats_fisher_test.R index 8fa50ce46..b4483c911 100644 --- a/R/ard_stats_fisher_test.R +++ b/R/ard_stats_fisher_test.R @@ -12,6 +12,8 @@ #' @param variables ([`tidy-select`][dplyr::dplyr_tidy_select])\cr #' column names to be compared. Independent tests will be computed for #' each variable. +#' @param conf.level (scalar `numeric`)\cr +#' confidence level for confidence interval. Default is `0.95`. #' @param ... additional arguments passed to `fisher.test(...)` #' #' @return ARD data frame @@ -20,7 +22,7 @@ #' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx")) #' cards::ADSL[1:30, ] |> #' ard_stats_fisher_test(by = "ARM", variables = "AGEGR1") -ard_stats_fisher_test <- function(data, by, variables, ...) { +ard_stats_fisher_test <- function(data, by, variables, conf.level = 0.95, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- @@ -45,7 +47,7 @@ ard_stats_fisher_test <- function(data, by, variables, ...) { cards::tidy_as_ard( lst_tidy = cards::eval_capture_conditions( - stats::fisher.test(x = data[[variable]], y = data[[by]], ...) |> + stats::fisher.test(x = data[[variable]], y = data[[by]], conf.level = conf.level, ...) |> broom::tidy() ), tidy_result_names = diff --git a/R/ard_stats_prop_test.R b/R/ard_stats_prop_test.R index f96784737..071ae9264 100644 --- a/R/ard_stats_prop_test.R +++ b/R/ard_stats_prop_test.R @@ -10,6 +10,8 @@ #' @param variables ([`tidy-select`][dplyr::dplyr_tidy_select])\cr #' column names to be compared. Must be a binary column coded as `TRUE`/`FALSE` #' or `1`/`0`. Independent tests will be computed for each variable. +#' @param conf.level (scalar `numeric`)\cr +#' confidence level for confidence interval. Default is `0.95`. #' @param ... arguments passed to `prop.test(...)` #' #' @return ARD data frame @@ -18,7 +20,7 @@ #' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx")) #' mtcars |> #' ard_stats_prop_test(by = vs, variables = am) -ard_stats_prop_test <- function(data, by, variables, ...) { +ard_stats_prop_test <- function(data, by, variables, conf.level = 0.95, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- @@ -72,6 +74,7 @@ ard_stats_prop_test <- function(data, by, variables, ...) { stats::prop.test( x = data_counts[["x"]], n = data_counts[["n"]], + conf.level = conf.level, ... ) |> broom::tidy() |> diff --git a/R/ard_stats_t_test.R b/R/ard_stats_t_test.R index b506d981c..010c1d571 100644 --- a/R/ard_stats_t_test.R +++ b/R/ard_stats_t_test.R @@ -12,6 +12,8 @@ #' each variable. #' @param id ([`tidy-select`][dplyr::dplyr_tidy_select])\cr #' column name of the subject or participant ID +#' @param conf.level (scalar `numeric`)\cr +#' confidence level for confidence interval. Default is `0.95`. #' @param ... arguments passed to `t.test(...)` #' #' @return ARD data frame @@ -43,7 +45,7 @@ NULL #' @rdname ard_stats_t_test #' @export -ard_stats_t_test <- function(data, variables, by = NULL, ...) { +ard_stats_t_test <- function(data, variables, by = NULL, conf.level = 0.95, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- @@ -72,7 +74,7 @@ ard_stats_t_test <- function(data, variables, by = NULL, ...) { lst_tidy = # styler: off cards::eval_capture_conditions( - if (!is_empty(by)) stats::t.test(data[[variable]] ~ data[[by]], ...) |> broom::tidy() + if (!is_empty(by)) stats::t.test(data[[variable]] ~ data[[by]], conf.level = conf.level, ...) |> broom::tidy() else stats::t.test(data[[variable]], ...) |> broom::tidy() ), # styler: on @@ -86,7 +88,7 @@ ard_stats_t_test <- function(data, variables, by = NULL, ...) { #' @rdname ard_stats_t_test #' @export -ard_stats_paired_t_test <- function(data, by, variables, id, ...) { +ard_stats_paired_t_test <- function(data, by, variables, id, conf.level = 0.95, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- @@ -120,7 +122,7 @@ ard_stats_paired_t_test <- function(data, by, variables, id, ...) { # adding this reshape inside the eval, so if there is an error it's captured in the ARD object data_wide <- .paired_data_pivot_wider(data, by = by, variable = variable, id = id) # perform paired t-test - stats::t.test(x = data_wide[["by1"]], y = data_wide[["by2"]], paired = TRUE, ...) |> + stats::t.test(x = data_wide[["by1"]], y = data_wide[["by2"]], paired = TRUE, conf.level = conf.level, ...) |> broom::tidy() }), paired = TRUE, diff --git a/R/ard_stats_wilcox_test.R b/R/ard_stats_wilcox_test.R index c2a14bd49..7c01fcb00 100644 --- a/R/ard_stats_wilcox_test.R +++ b/R/ard_stats_wilcox_test.R @@ -12,6 +12,8 @@ #' each variable. #' @param id ([`tidy-select`][dplyr::dplyr_tidy_select])\cr #' column name of the subject or participant ID. +#' @param conf.level (scalar `numeric`)\cr +#' confidence level for confidence interval. Default is `0.95`. #' @param ... arguments passed to `wilcox.test(...)` #' #' @return ARD data frame @@ -43,7 +45,7 @@ NULL #' @rdname ard_stats_wilcox_test #' @export -ard_stats_wilcox_test <- function(data, variables, by = NULL, ...) { +ard_stats_wilcox_test <- function(data, variables, by = NULL, conf.level = 0.95, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- @@ -73,7 +75,7 @@ ard_stats_wilcox_test <- function(data, variables, by = NULL, ...) { # styler: off cards::eval_capture_conditions( if (!is_empty(by)) { - stats::wilcox.test(data[[variable]] ~ data[[by]], ...) |> + stats::wilcox.test(data[[variable]] ~ data[[by]], conf.level = conf.level, ...) |> broom::tidy() } else { @@ -92,7 +94,7 @@ ard_stats_wilcox_test <- function(data, variables, by = NULL, ...) { #' @rdname ard_stats_wilcox_test #' @export -ard_stats_paired_wilcox_test <- function(data, by, variables, id, ...) { +ard_stats_paired_wilcox_test <- function(data, by, variables, id, conf.level = 0.95, ...) { set_cli_abort_call() # check installed packages --------------------------------------------------- @@ -126,7 +128,7 @@ ard_stats_paired_wilcox_test <- function(data, by, variables, id, ...) { # adding this reshape inside the eval, so if there is an error it's captured in the ARD object data_wide <- .paired_data_pivot_wider(data, by = by, variable = variable, id = id) # perform paired wilcox test - stats::wilcox.test(x = data_wide[["by1"]], y = data_wide[["by2"]], paired = TRUE, ...) |> + stats::wilcox.test(x = data_wide[["by1"]], y = data_wide[["by2"]], paired = TRUE, conf.level = conf.level, ...) |> broom::tidy() }), paired = TRUE, diff --git a/man/ard_effectsize_cohens_d.Rd b/man/ard_effectsize_cohens_d.Rd index 3eb2ac94e..93c907aa6 100644 --- a/man/ard_effectsize_cohens_d.Rd +++ b/man/ard_effectsize_cohens_d.Rd @@ -5,9 +5,9 @@ \alias{ard_effectsize_paired_cohens_d} \title{ARD Cohen's D Test} \usage{ -ard_effectsize_cohens_d(data, by, variables, ...) +ard_effectsize_cohens_d(data, by, variables, conf.level = 0.95, ...) -ard_effectsize_paired_cohens_d(data, by, variables, id, ...) +ard_effectsize_paired_cohens_d(data, by, variables, id, conf.level = 0.95, ...) } \arguments{ \item{data}{(\code{data.frame})\cr @@ -20,6 +20,9 @@ column name to compare by. Must be a categorical variable with exactly two level column names to be compared. Must be a continuous variables. Independent tests will be run for each variable.} +\item{conf.level}{(scalar \code{numeric})\cr +confidence level for confidence interval. Default is \code{0.95}.} + \item{...}{arguments passed to \code{effectsize::cohens_d(...)}} \item{id}{(\code{\link[dplyr:dplyr_tidy_select]{tidy-select}})\cr diff --git a/man/ard_effectsize_hedges_g.Rd b/man/ard_effectsize_hedges_g.Rd index 5ec59117a..23c43e8d2 100644 --- a/man/ard_effectsize_hedges_g.Rd +++ b/man/ard_effectsize_hedges_g.Rd @@ -5,9 +5,9 @@ \alias{ard_effectsize_paired_hedges_g} \title{ARD Hedge's G Test} \usage{ -ard_effectsize_hedges_g(data, by, variables, ...) +ard_effectsize_hedges_g(data, by, variables, conf.level = 0.95, ...) -ard_effectsize_paired_hedges_g(data, by, variables, id, ...) +ard_effectsize_paired_hedges_g(data, by, variables, id, conf.level = 0.95, ...) } \arguments{ \item{data}{(\code{data.frame})\cr @@ -20,6 +20,9 @@ column name to compare by. Must be a categorical variable with exactly two level column names to be compared. Must be a continuous variable. Independent tests will be run for each variable} +\item{conf.level}{(scalar \code{numeric})\cr +confidence level for confidence interval. Default is \code{0.95}.} + \item{...}{arguments passed to \code{effectsize::hedges_g(...)}} \item{id}{(\code{\link[dplyr:dplyr_tidy_select]{tidy-select}})\cr diff --git a/man/ard_stats_fisher_test.Rd b/man/ard_stats_fisher_test.Rd index 1e07809b0..7831e81e9 100644 --- a/man/ard_stats_fisher_test.Rd +++ b/man/ard_stats_fisher_test.Rd @@ -4,7 +4,7 @@ \alias{ard_stats_fisher_test} \title{ARD Fisher's Exact Test} \usage{ -ard_stats_fisher_test(data, by, variables, ...) +ard_stats_fisher_test(data, by, variables, conf.level = 0.95, ...) } \arguments{ \item{data}{(\code{data.frame})\cr @@ -17,6 +17,9 @@ column name to compare by} column names to be compared. Independent tests will be computed for each variable.} +\item{conf.level}{(scalar \code{numeric})\cr +confidence level for confidence interval. Default is \code{0.95}.} + \item{...}{additional arguments passed to \code{fisher.test(...)}} } \value{ diff --git a/man/ard_stats_prop_test.Rd b/man/ard_stats_prop_test.Rd index cb966e1c4..61bf61791 100644 --- a/man/ard_stats_prop_test.Rd +++ b/man/ard_stats_prop_test.Rd @@ -4,7 +4,7 @@ \alias{ard_stats_prop_test} \title{ARD 2-sample proportion test} \usage{ -ard_stats_prop_test(data, by, variables, ...) +ard_stats_prop_test(data, by, variables, conf.level = 0.95, ...) } \arguments{ \item{data}{(\code{data.frame})\cr @@ -17,6 +17,9 @@ column name to compare by} column names to be compared. Must be a binary column coded as \code{TRUE}/\code{FALSE} or \code{1}/\code{0}. Independent tests will be computed for each variable.} +\item{conf.level}{(scalar \code{numeric})\cr +confidence level for confidence interval. Default is \code{0.95}.} + \item{...}{arguments passed to \code{prop.test(...)}} } \value{ diff --git a/man/ard_stats_t_test.Rd b/man/ard_stats_t_test.Rd index 1bfb7fbe9..edd55ee94 100644 --- a/man/ard_stats_t_test.Rd +++ b/man/ard_stats_t_test.Rd @@ -5,9 +5,9 @@ \alias{ard_stats_paired_t_test} \title{ARD t-test} \usage{ -ard_stats_t_test(data, variables, by = NULL, ...) +ard_stats_t_test(data, variables, by = NULL, conf.level = 0.95, ...) -ard_stats_paired_t_test(data, by, variables, id, ...) +ard_stats_paired_t_test(data, by, variables, id, conf.level = 0.95, ...) } \arguments{ \item{data}{(\code{data.frame})\cr @@ -20,6 +20,9 @@ each variable.} \item{by}{(\code{\link[dplyr:dplyr_tidy_select]{tidy-select}})\cr optional column name to compare by.} +\item{conf.level}{(scalar \code{numeric})\cr +confidence level for confidence interval. Default is \code{0.95}.} + \item{...}{arguments passed to \code{t.test(...)}} \item{id}{(\code{\link[dplyr:dplyr_tidy_select]{tidy-select}})\cr diff --git a/man/ard_stats_wilcox_test.Rd b/man/ard_stats_wilcox_test.Rd index 14f48b213..86486171b 100644 --- a/man/ard_stats_wilcox_test.Rd +++ b/man/ard_stats_wilcox_test.Rd @@ -5,9 +5,9 @@ \alias{ard_stats_paired_wilcox_test} \title{ARD Wilcoxon Rank-Sum Test} \usage{ -ard_stats_wilcox_test(data, variables, by = NULL, ...) +ard_stats_wilcox_test(data, variables, by = NULL, conf.level = 0.95, ...) -ard_stats_paired_wilcox_test(data, by, variables, id, ...) +ard_stats_paired_wilcox_test(data, by, variables, id, conf.level = 0.95, ...) } \arguments{ \item{data}{(\code{data.frame})\cr @@ -20,6 +20,9 @@ each variable.} \item{by}{(\code{\link[dplyr:dplyr_tidy_select]{tidy-select}})\cr optional column name to compare by.} +\item{conf.level}{(scalar \code{numeric})\cr +confidence level for confidence interval. Default is \code{0.95}.} + \item{...}{arguments passed to \code{wilcox.test(...)}} \item{id}{(\code{\link[dplyr:dplyr_tidy_select]{tidy-select}})\cr diff --git a/man/dot-format_cohens_d_results.Rd b/man/dot-format_cohens_d_results.Rd index 20edfa95e..ca65e400c 100644 --- a/man/dot-format_cohens_d_results.Rd +++ b/man/dot-format_cohens_d_results.Rd @@ -17,7 +17,7 @@ e.g. \code{eval_capture_conditions(t.test(mtcars$mpg ~ mtcars$am) |> broom::tidy \item{paired}{If \code{TRUE}, the values of \code{x} and \code{y} are considered as paired. This produces an effect size that is equivalent to the one-sample effect -size on \code{x - y}. See also \code{\link[effectsize:repeated_measures_d]{repeated_measures_d()}} for more options.} +size on \code{x - y}.} \item{...}{passed to \code{cohens_d(...)}} } diff --git a/man/dot-format_hedges_g_results.Rd b/man/dot-format_hedges_g_results.Rd index d22e5b762..e0f0328b3 100644 --- a/man/dot-format_hedges_g_results.Rd +++ b/man/dot-format_hedges_g_results.Rd @@ -17,7 +17,7 @@ e.g. \code{eval_capture_conditions(t.test(mtcars$mpg ~ mtcars$am) |> broom::tidy \item{paired}{If \code{TRUE}, the values of \code{x} and \code{y} are considered as paired. This produces an effect size that is equivalent to the one-sample effect -size on \code{x - y}. See also \code{\link[effectsize:repeated_measures_d]{repeated_measures_d()}} for more options.} +size on \code{x - y}.} \item{...}{passed to \code{hedges_g(...)}} } From 3fe8e28ecaeca7a561702eb89c73bcdcc339a4b4 Mon Sep 17 00:00:00 2001 From: Daniel Sjoberg Date: Fri, 3 May 2024 16:09:26 -0700 Subject: [PATCH 2/3] redoc --- man/dot-format_cohens_d_results.Rd | 2 +- man/dot-format_hedges_g_results.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/man/dot-format_cohens_d_results.Rd b/man/dot-format_cohens_d_results.Rd index ca65e400c..20edfa95e 100644 --- a/man/dot-format_cohens_d_results.Rd +++ b/man/dot-format_cohens_d_results.Rd @@ -17,7 +17,7 @@ e.g. \code{eval_capture_conditions(t.test(mtcars$mpg ~ mtcars$am) |> broom::tidy \item{paired}{If \code{TRUE}, the values of \code{x} and \code{y} are considered as paired. This produces an effect size that is equivalent to the one-sample effect -size on \code{x - y}.} +size on \code{x - y}. See also \code{\link[effectsize:repeated_measures_d]{repeated_measures_d()}} for more options.} \item{...}{passed to \code{cohens_d(...)}} } diff --git a/man/dot-format_hedges_g_results.Rd b/man/dot-format_hedges_g_results.Rd index e0f0328b3..d22e5b762 100644 --- a/man/dot-format_hedges_g_results.Rd +++ b/man/dot-format_hedges_g_results.Rd @@ -17,7 +17,7 @@ e.g. \code{eval_capture_conditions(t.test(mtcars$mpg ~ mtcars$am) |> broom::tidy \item{paired}{If \code{TRUE}, the values of \code{x} and \code{y} are considered as paired. This produces an effect size that is equivalent to the one-sample effect -size on \code{x - y}.} +size on \code{x - y}. See also \code{\link[effectsize:repeated_measures_d]{repeated_measures_d()}} for more options.} \item{...}{passed to \code{hedges_g(...)}} } From 0d415ff412760085d5c77bed52f7ddfbfb90c25f Mon Sep 17 00:00:00 2001 From: Daniel Sjoberg Date: Fri, 3 May 2024 16:19:07 -0700 Subject: [PATCH 3/3] adding check --- R/ard_effectsize_cohens_d.R | 3 ++- R/ard_effectsize_hedges_g.R | 2 ++ R/ard_stats_fisher_test.R | 1 + R/ard_stats_prop_test.R | 1 + R/ard_stats_t_test.R | 1 + R/ard_stats_wilcox_test.R | 1 + R/ard_survey_svychisq.R | 2 +- man/ard_survey_svychisq.Rd | 2 +- 8 files changed, 10 insertions(+), 3 deletions(-) diff --git a/R/ard_effectsize_cohens_d.R b/R/ard_effectsize_cohens_d.R index 156a5a9ee..91f5441a1 100644 --- a/R/ard_effectsize_cohens_d.R +++ b/R/ard_effectsize_cohens_d.R @@ -62,7 +62,7 @@ ard_effectsize_cohens_d <- function(data, by, variables, conf.level = 0.95, ...) data <- dplyr::ungroup(data) cards::process_selectors(data, by = {{ by }}, variables = {{ variables }}) check_scalar(by) - + check_range(conf.level, range = c(0, 1)) # if no variables selected, return empty tibble ------------------------------ if (is_empty(variables)) { return(dplyr::tibble()) @@ -107,6 +107,7 @@ ard_effectsize_paired_cohens_d <- function(data, by, variables, id, conf.level = cards::process_selectors(data, by = {{ by }}, variables = {{ variables }}, id = {{ id }}) check_scalar(by) check_scalar(id) + check_range(conf.level, range = c(0, 1)) # if no variables selected, return empty tibble ------------------------------ if (is_empty(variables)) { diff --git a/R/ard_effectsize_hedges_g.R b/R/ard_effectsize_hedges_g.R index d6575921d..58b228b5d 100644 --- a/R/ard_effectsize_hedges_g.R +++ b/R/ard_effectsize_hedges_g.R @@ -61,6 +61,7 @@ ard_effectsize_hedges_g <- function(data, by, variables, conf.level = 0.95, ...) data <- dplyr::ungroup(data) cards::process_selectors(data, by = {{ by }}, variables = {{ variables }}) check_scalar(by) + check_range(conf.level, range = c(0, 1)) # if no variables selected, return empty tibble ------------------------------ if (is_empty(variables)) { @@ -111,6 +112,7 @@ ard_effectsize_paired_hedges_g <- function(data, by, variables, id, conf.level = cards::process_selectors(data, by = {{ by }}, variables = {{ variables }}, id = {{ id }}) check_scalar(by) check_scalar(id) + check_range(conf.level, range = c(0, 1)) # if no variables selected, return empty tibble ------------------------------ if (is_empty(variables)) { diff --git a/R/ard_stats_fisher_test.R b/R/ard_stats_fisher_test.R index b4483c911..0831f45bc 100644 --- a/R/ard_stats_fisher_test.R +++ b/R/ard_stats_fisher_test.R @@ -35,6 +35,7 @@ ard_stats_fisher_test <- function(data, by, variables, conf.level = 0.95, ...) { check_data_frame(data) cards::process_selectors(data, by = {{ by }}, variables = {{ variables }}) check_scalar(by) + check_range(conf.level, range = c(0, 1)) # if no variables selected, return empty tibble ------------------------------ if (is_empty(variables)) { diff --git a/R/ard_stats_prop_test.R b/R/ard_stats_prop_test.R index 071ae9264..1b4389814 100644 --- a/R/ard_stats_prop_test.R +++ b/R/ard_stats_prop_test.R @@ -31,6 +31,7 @@ ard_stats_prop_test <- function(data, by, variables, conf.level = 0.95, ...) { check_not_missing(variables) check_not_missing(by) check_data_frame(data) + check_range(conf.level, range = c(0, 1)) # process inputs ------------------------------------------------------------- cards::process_selectors(data, by = {{ by }}, variables = {{ variables }}) diff --git a/R/ard_stats_t_test.R b/R/ard_stats_t_test.R index 010c1d571..91e603c58 100644 --- a/R/ard_stats_t_test.R +++ b/R/ard_stats_t_test.R @@ -58,6 +58,7 @@ ard_stats_t_test <- function(data, variables, by = NULL, conf.level = 0.95, ...) data <- dplyr::ungroup(data) cards::process_selectors(data, by = {{ by }}, variables = {{ variables }}) check_scalar(by, allow_empty = TRUE) + check_range(conf.level, range = c(0, 1)) # if no variables selected, return empty tibble ------------------------------ if (is_empty(variables)) { diff --git a/R/ard_stats_wilcox_test.R b/R/ard_stats_wilcox_test.R index 7c01fcb00..5972230bb 100644 --- a/R/ard_stats_wilcox_test.R +++ b/R/ard_stats_wilcox_test.R @@ -58,6 +58,7 @@ ard_stats_wilcox_test <- function(data, variables, by = NULL, conf.level = 0.95, data <- dplyr::ungroup(data) cards::process_selectors(data, by = {{ by }}, variables = {{ variables }}) check_scalar(by, allow_empty = TRUE) + check_range(conf.level, range = c(0, 1)) # if no variables selected, return empty tibble ------------------------------ if (is_empty(variables)) { diff --git a/R/ard_survey_svychisq.R b/R/ard_survey_svychisq.R index 8fb57325f..5ad520a42 100644 --- a/R/ard_survey_svychisq.R +++ b/R/ard_survey_svychisq.R @@ -5,7 +5,7 @@ #' Only two-way comparisons are supported. #' #' @param data (`survey.design`)\cr -#' a survey design object often created with the {survey} package +#' a survey design object often created with the \{survey\} package #' @param by ([`tidy-select`][dplyr::dplyr_tidy_select])\cr #' column name to compare by. #' @param variables ([`tidy-select`][dplyr::dplyr_tidy_select])\cr diff --git a/man/ard_survey_svychisq.Rd b/man/ard_survey_svychisq.Rd index e645f5c00..05d660264 100644 --- a/man/ard_survey_svychisq.Rd +++ b/man/ard_survey_svychisq.Rd @@ -8,7 +8,7 @@ ard_survey_svychisq(data, by, variables, statistic = "F", ...) } \arguments{ \item{data}{(\code{survey.design})\cr -a survey design object often created with the {survey} package} +a survey design object often created with the \{survey\} package} \item{by}{(\code{\link[dplyr:dplyr_tidy_select]{tidy-select}})\cr column name to compare by.}