From c7bca586f5efe537d127489f730b8f035bd2610d Mon Sep 17 00:00:00 2001 From: Daniel Sjoberg Date: Fri, 5 Jul 2024 12:18:03 -0700 Subject: [PATCH] styler --- R/ard_categorical_ci.R | 42 ++++++++++++++-------------- R/ard_categorical_ci.survey.design.R | 6 ++-- R/ard_continuous_ci.R | 3 +- R/ard_continuous_ci.survey.design.R | 18 ++++++------ 4 files changed, 34 insertions(+), 35 deletions(-) diff --git a/R/ard_categorical_ci.R b/R/ard_categorical_ci.R index b029e3a4e..409d56cc2 100644 --- a/R/ard_categorical_ci.R +++ b/R/ard_categorical_ci.R @@ -117,27 +117,27 @@ ard_categorical_ci.data.frame <- function(data, ~ list( prop_ci = switch(method, - "waldcc" = \(x, ...) proportion_ci_wald(x, conf.level = conf.level, correct = TRUE), - "wald" = \(x, ...) proportion_ci_wald(x, conf.level = conf.level, correct = FALSE), - "wilsoncc" = \(x, ...) proportion_ci_wilson(x, conf.level = conf.level, correct = TRUE), - "wilson" = \(x, ...) proportion_ci_wilson(x, conf.level = conf.level, correct = FALSE), - "clopper-pearson" = \(x, ...) proportion_ci_clopper_pearson(x, conf.level = conf.level), - "agresti-coull" = \(x, ...) proportion_ci_agresti_coull(x, conf.level = conf.level), - "jeffreys" = \(x, ...) proportion_ci_jeffreys(x, conf.level = conf.level), - "strat_wilsoncc" = \(x, data, ...) { - proportion_ci_strat_wilson(x, - strata = data[[strata]], weights = weights, - max.iterations = max.iterations, - conf.level = conf.level, correct = TRUE - ) - }, - "strat_wilson" = \(x, data, ...) { - proportion_ci_strat_wilson(x, - strata = data[[strata]], weights = weights, - max.iterations = max.iterations, - conf.level = conf.level, correct = FALSE - ) - } + "waldcc" = \(x, ...) proportion_ci_wald(x, conf.level = conf.level, correct = TRUE), + "wald" = \(x, ...) proportion_ci_wald(x, conf.level = conf.level, correct = FALSE), + "wilsoncc" = \(x, ...) proportion_ci_wilson(x, conf.level = conf.level, correct = TRUE), + "wilson" = \(x, ...) proportion_ci_wilson(x, conf.level = conf.level, correct = FALSE), + "clopper-pearson" = \(x, ...) proportion_ci_clopper_pearson(x, conf.level = conf.level), + "agresti-coull" = \(x, ...) proportion_ci_agresti_coull(x, conf.level = conf.level), + "jeffreys" = \(x, ...) proportion_ci_jeffreys(x, conf.level = conf.level), + "strat_wilsoncc" = \(x, data, ...) { + proportion_ci_strat_wilson(x, + strata = data[[strata]], weights = weights, + max.iterations = max.iterations, + conf.level = conf.level, correct = TRUE + ) + }, + "strat_wilson" = \(x, data, ...) { + proportion_ci_strat_wilson(x, + strata = data[[strata]], weights = weights, + max.iterations = max.iterations, + conf.level = conf.level, correct = FALSE + ) + } ) ) ) |> diff --git a/R/ard_categorical_ci.survey.design.R b/R/ard_categorical_ci.survey.design.R index 68ab5c1ef..bce2cec08 100644 --- a/R/ard_categorical_ci.survey.design.R +++ b/R/ard_categorical_ci.survey.design.R @@ -126,11 +126,11 @@ ard_categorical_ci.survey.design <- function(data, conf.level = .env$conf.level, ... ) |> - list(), + list(), result = .data$lst_result[["result"]] |> - enframe("stat_name", "stat") |> - list(), + enframe("stat_name", "stat") |> + list(), warning = .data$lst_result["warning"] |> unname(), error = .data$lst_result["error"] |> unname(), context = "survey_categorical_ci" diff --git a/R/ard_continuous_ci.R b/R/ard_continuous_ci.R index 69ca5d060..68f8ebde3 100644 --- a/R/ard_continuous_ci.R +++ b/R/ard_continuous_ci.R @@ -33,8 +33,7 @@ ard_continuous_ci.data.frame <- function(data, variables, by = dplyr::group_vars method <- arg_match(method) # calculate CIs -------------------------------------------------------------- - switch( - method, + switch(method, "t.test" = ard_stats_t_test_onesample( data = data, diff --git a/R/ard_continuous_ci.survey.design.R b/R/ard_continuous_ci.survey.design.R index 10f95d08f..a8579dbec 100644 --- a/R/ard_continuous_ci.survey.design.R +++ b/R/ard_continuous_ci.survey.design.R @@ -26,12 +26,12 @@ #' ard_continuous_ci(dclus1, variables = api00) #' ard_continuous_ci(dclus1, variables = api00, method = "svymedian.xlogit") ard_continuous_ci.survey.design <- function(data, - variables, - by = NULL, - method = c("svymean", "svymedian.mean", "svymedian.beta", "svymedian.xlogit", "svymedian.asin", "svymedian.score"), - conf.level = 0.95, - df = survey::degf(data), - ...) { + variables, + by = NULL, + method = c("svymean", "svymedian.mean", "svymedian.beta", "svymedian.xlogit", "svymedian.asin", "svymedian.score"), + conf.level = 0.95, + df = survey::degf(data), + ...) { set_cli_abort_call() # check inputs --------------------------------------------------------------- @@ -127,11 +127,11 @@ ard_continuous_ci.survey.design <- function(data, conf.level = .env$conf.level, ... ) |> - list(), + list(), result = .data$lst_result[["result"]] |> - enframe("stat_name", "stat") |> - list(), + enframe("stat_name", "stat") |> + list(), warning = .data$lst_result["warning"] |> unname(), error = .data$lst_result["error"] |> unname(), context = "survey_continuous_ci"