From ca914446049b93b078af47a703c67cc1ee38c72d Mon Sep 17 00:00:00 2001 From: Abinaya Yogasekaram <73252787+ayogasekaram@users.noreply.github.com> Date: Tue, 16 Apr 2024 19:07:57 -0400 Subject: [PATCH] update context after renaming ard_* functions (#123) **What changes are proposed in this pull request?** update context after renaming `ard_*()` functions closes #117 -------------------------------------------------------------------------------- Pre-review Checklist (if item does not apply, mark is as complete) - [x] **All** GitHub Action workflows pass with a :white_check_mark: - [x] PR branch has pulled the most recent updates from master branch: `usethis::pr_merge_main()` - [x] If a bug was fixed, a unit test was added. - [x] If a new `ard_*()` function was added, it passes the ARD structural checks from `cards::check_ard_structure()`. - [x] 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) - [ ] If a bug was fixed, a unit test was added. - [ ] Code coverage is suitable for any new functions/features: `devtools::test_coverage()` When the branch is ready to be merged: - [ ] Update `NEWS.md` with the changes from this pull request under the heading "`# cardx (development version)`". If there is an issue associated with the pull request, reference it in parentheses at the end update (see `NEWS.md` for examples). - [ ] **All** GitHub Action workflows pass with a :white_check_mark: - [ ] Approve Pull Request - [ ] Merge the PR. Please use "Squash and merge" or "Rebase and merge". --- R/ard_car_vif.R | 2 +- R/ard_effectsize_cohens_d.R | 2 +- R/ard_effectsize_hedges_g.R | 2 +- R/ard_smd_smd.R | 2 +- R/ard_stats_aov.R | 2 +- R/ard_stats_chisq_test.R | 2 +- R/ard_stats_fisher_test.R | 2 +- R/ard_stats_kruskal_test.R | 2 +- R/ard_stats_mcnemar_test.R | 2 +- R/ard_stats_mood_test.R | 2 +- R/ard_stats_oneway_test.R | 2 +- R/ard_stats_prop_test.R | 2 +- R/ard_stats_t_test.R | 2 +- R/ard_stats_wilcox_test.R | 2 +- R/ard_survey_svychisq.R | 2 +- R/ard_survey_svycontinuous.R | 2 +- R/ard_survey_svyranktest.R | 2 +- R/ard_survey_svyttest.R | 2 +- R/ard_survival_survfit.R | 2 +- tests/testthat/_snaps/ard_car_vif.md | 24 ++-- .../_snaps/ard_effectsize_cohens_d.md | 14 +- .../_snaps/ard_effectsize_hedges_g.md | 14 +- tests/testthat/_snaps/ard_stats_aov.md | 22 ++-- tests/testthat/_snaps/ard_stats_chisq_test.md | 18 +-- .../testthat/_snaps/ard_stats_kruskal_test.md | 25 ++-- tests/testthat/_snaps/ard_stats_mood_test.md | 10 +- tests/testthat/_snaps/ard_stats_t_test.md | 120 +++++++++--------- tests/testthat/_snaps/ard_survey_svychisq.md | 14 +- .../_snaps/ard_survey_svycontinuous.md | 36 +++--- tests/testthat/_snaps/ard_survival_survfit.md | 14 +- 30 files changed, 177 insertions(+), 172 deletions(-) diff --git a/R/ard_car_vif.R b/R/ard_car_vif.R index 25397e9e5..74088eb4b 100644 --- a/R/ard_car_vif.R +++ b/R/ard_car_vif.R @@ -73,7 +73,7 @@ ard_car_vif <- function(x, ...) { values_to = "stat" ) |> dplyr::mutate( - context = "vif", + context = "car_vif", stat_label = ifelse( .data$stat_name == "aGVIF", "Adjusted GVIF", diff --git a/R/ard_effectsize_cohens_d.R b/R/ard_effectsize_cohens_d.R index a0c298d93..b0c51df9b 100644 --- a/R/ard_effectsize_cohens_d.R +++ b/R/ard_effectsize_cohens_d.R @@ -181,7 +181,7 @@ ard_effectsize_paired_cohens_d <- function(data, by, variables, id, ...) { fun_args_to_record = c("mu", "paired", "pooled_sd", "alternative"), formals = formals(asNamespace("effectsize")[["cohens_d"]]), passed_args = c(list(paired = paired), dots_list(...)), - lst_ard_columns = list(group1 = by, variable = variable, context = "cohens_d") + lst_ard_columns = list(group1 = by, variable = variable, context = "effectsize_cohens_d") ) # add the stat label --------------------------------------------------------- diff --git a/R/ard_effectsize_hedges_g.R b/R/ard_effectsize_hedges_g.R index 8b5b9da6f..3cdcf3a8d 100644 --- a/R/ard_effectsize_hedges_g.R +++ b/R/ard_effectsize_hedges_g.R @@ -173,7 +173,7 @@ ard_effectsize_paired_hedges_g <- function(data, by, variables, id, ...) { fun_args_to_record = c("mu", "paired", "pooled_sd", "alternative"), formals = formals(asNamespace("effectsize")[["hedges_g"]]), passed_args = c(list(paired = paired), dots_list(...)), - lst_ard_columns = list(group1 = by, variable = variable, context = "hedges_g") + lst_ard_columns = list(group1 = by, variable = variable, context = "effectsize_hedges_g") ) # add the stat label --------------------------------------------------------- diff --git a/R/ard_smd_smd.R b/R/ard_smd_smd.R index b468c9f1d..7bcd80c85 100644 --- a/R/ard_smd_smd.R +++ b/R/ard_smd_smd.R @@ -81,7 +81,7 @@ ard_smd_smd <- function(data, by, variables, ...) { formals = formals(smd::smd)["gref"], # removing the `std.error` ARGUMENT (not the result) passed_args = dots_list(...) |> utils::modifyList(list(std.error = NULL)), - lst_ard_columns = list(group1 = by, variable = variable, context = "smd") + lst_ard_columns = list(group1 = by, variable = variable, context = "smd_smd") ) # add the stat label --------------------------------------------------------- diff --git a/R/ard_stats_aov.R b/R/ard_stats_aov.R index cc335102f..81849ba42 100644 --- a/R/ard_stats_aov.R +++ b/R/ard_stats_aov.R @@ -49,7 +49,7 @@ ard_stats_aov <- function(formula, data, ...) { .data$stat_name %in% "meansq" ~ "Mean of Sum of Squares", TRUE ~ .data$stat_name ), - context = "aov", + context = "stats_aov", warning = aov["warning"], error = aov["error"] ) |> diff --git a/R/ard_stats_chisq_test.R b/R/ard_stats_chisq_test.R index b3dae0366..8ab8c6ff8 100644 --- a/R/ard_stats_chisq_test.R +++ b/R/ard_stats_chisq_test.R @@ -53,7 +53,7 @@ ard_stats_chisq_test <- function(data, by, variables, ...) { c("correct", "p", "rescale.p", "simulate.p.value", "B"), formals = formals(stats::chisq.test), passed_args = dots_list(...), - lst_ard_columns = list(group1 = by, variable = variable, context = "chisqtest") + lst_ard_columns = list(group1 = by, variable = variable, context = "stats_chisq_test") ) |> dplyr::mutate( .after = "stat_name", diff --git a/R/ard_stats_fisher_test.R b/R/ard_stats_fisher_test.R index 3402bd8e0..8fa50ce46 100644 --- a/R/ard_stats_fisher_test.R +++ b/R/ard_stats_fisher_test.R @@ -57,7 +57,7 @@ ard_stats_fisher_test <- function(data, by, variables, ...) { ), formals = formals(stats::fisher.test), passed_args = dots_list(...), - lst_ard_columns = list(group1 = by, variable = variable, context = "fishertest") + lst_ard_columns = list(group1 = by, variable = variable, context = "stats_fisher_test") ) |> dplyr::mutate( .after = "stat_name", diff --git a/R/ard_stats_kruskal_test.R b/R/ard_stats_kruskal_test.R index 5a804c793..7f7b3b359 100644 --- a/R/ard_stats_kruskal_test.R +++ b/R/ard_stats_kruskal_test.R @@ -48,7 +48,7 @@ ard_stats_kruskal_test <- function(data, by, variables) { broom::tidy() ), tidy_result_names = c("statistic", "p.value", "parameter", "method"), - lst_ard_columns = list(group1 = by, variable = variable, context = "kruskaltest") + lst_ard_columns = list(group1 = by, variable = variable, context = "stats_kruskal_test") ) |> dplyr::mutate( .after = "stat_name", diff --git a/R/ard_stats_mcnemar_test.R b/R/ard_stats_mcnemar_test.R index 4a928d561..fb6f31221 100644 --- a/R/ard_stats_mcnemar_test.R +++ b/R/ard_stats_mcnemar_test.R @@ -92,7 +92,7 @@ ard_stats_mcnemar_test <- function(data, by, variables, ...) { fun_args_to_record = c("correct"), formals = formals(asNamespace("stats")[["mcnemar.test"]]), passed_args = dots_list(...), - lst_ard_columns = list(group1 = by, variable = variable, context = "mcnemartest") + lst_ard_columns = list(group1 = by, variable = variable, context = "stats_mcnemar_test") ) # add the stat label --------------------------------------------------------- diff --git a/R/ard_stats_mood_test.R b/R/ard_stats_mood_test.R index 8882cb067..75d3464e4 100644 --- a/R/ard_stats_mood_test.R +++ b/R/ard_stats_mood_test.R @@ -91,7 +91,7 @@ ard_stats_mood_test <- function(data, by, variables, ...) { tidy_result_names = c("statistic", "p.value", "method", "alternative"), formals = formals(asNamespace("stats")[["mood.test.default"]]), passed_args = c(dots_list(...)), - lst_ard_columns = list(group1 = by, variable = variable, context = "moodtest") + lst_ard_columns = list(group1 = by, variable = variable, context = "stats_mood_test") ) # add the stat label --------------------------------------------------------- diff --git a/R/ard_stats_oneway_test.R b/R/ard_stats_oneway_test.R index cc1d01773..ed4eadded 100644 --- a/R/ard_stats_oneway_test.R +++ b/R/ard_stats_oneway_test.R @@ -37,7 +37,7 @@ ard_stats_oneway_test <- function(formula, data, ...) { c("var.equal"), formals = formals(stats::oneway.test), passed_args = dots_list(...), - lst_ard_columns = list(context = "oneway.test") + lst_ard_columns = list(context = "stats_oneway_test") ) |> dplyr::mutate( .after = "stat_name", diff --git a/R/ard_stats_prop_test.R b/R/ard_stats_prop_test.R index ce3958c89..f96784737 100644 --- a/R/ard_stats_prop_test.R +++ b/R/ard_stats_prop_test.R @@ -108,7 +108,7 @@ ard_stats_prop_test <- function(data, by, variables, ...) { fun_args_to_record = c("p", "conf.level", "correct"), formals = formals(stats::prop.test), passed_args = dots_list(...), - lst_ard_columns = list(group1 = by, variable = variable, context = "proptest") + lst_ard_columns = list(group1 = by, variable = variable, context = "stats_prop_test") ) # add the stat label --------------------------------------------------------- diff --git a/R/ard_stats_t_test.R b/R/ard_stats_t_test.R index d00e05fa9..b506d981c 100644 --- a/R/ard_stats_t_test.R +++ b/R/ard_stats_t_test.R @@ -168,7 +168,7 @@ ard_stats_paired_t_test <- function(data, by, variables, id, ...) { fun_args_to_record = c("mu", "paired", "var.equal", "conf.level"), formals = formals(asNamespace("stats")[["t.test.default"]]), passed_args = c(list(paired = paired), dots_list(...)), - lst_ard_columns = list(variable = variable, context = "ttest") + lst_ard_columns = list(variable = variable, context = "stats_t_test") ) if (!is_empty(by)) { diff --git a/R/ard_stats_wilcox_test.R b/R/ard_stats_wilcox_test.R index adff590f9..c2a14bd49 100644 --- a/R/ard_stats_wilcox_test.R +++ b/R/ard_stats_wilcox_test.R @@ -178,7 +178,7 @@ ard_stats_paired_wilcox_test <- function(data, by, variables, id, ...) { ), formals = formals(asNamespace("stats")[["wilcox.test.default"]]), passed_args = c(list(paired = paired), dots_list(...)), - lst_ard_columns = list(variable = variable, context = "wilcoxtest") + lst_ard_columns = list(variable = variable, context = "stats_wilcox_test") ) if (!is_empty(by)) { diff --git a/R/ard_survey_svychisq.R b/R/ard_survey_svychisq.R index 91ea9c77a..f5c092c99 100644 --- a/R/ard_survey_svychisq.R +++ b/R/ard_survey_svychisq.R @@ -55,7 +55,7 @@ ard_survey_svychisq <- function(data, by, variables, statistic = "F", ...) { ), tidy_result_names = c("statistic", "p.value", "ndf", "ddf", "method"), passed_args = dots_list(...), - lst_ard_columns = list(group1 = by, variable = variable, context = "svychisq") + lst_ard_columns = list(group1 = by, variable = variable, context = "survey_svychisq") ) |> dplyr::mutate( .after = "stat_name", diff --git a/R/ard_survey_svycontinuous.R b/R/ard_survey_svycontinuous.R index 88341edd4..d9c40afa4 100644 --- a/R/ard_survey_svycontinuous.R +++ b/R/ard_survey_svycontinuous.R @@ -138,7 +138,7 @@ ard_survey_svycontinuous <- function(data, variables, by = NULL, # add class and return ARD object -------------------------------------------- df_stats |> - dplyr::mutate(context = "continuous") |> + dplyr::mutate(context = "survey_svycontinuous") |> cards::tidy_ard_column_order() %>% {structure(., class = c("card", class(.)))} # styler: off } diff --git a/R/ard_survey_svyranktest.R b/R/ard_survey_svyranktest.R index 8116c25ae..38fe77c5e 100644 --- a/R/ard_survey_svyranktest.R +++ b/R/ard_survey_svyranktest.R @@ -68,7 +68,7 @@ ard_survey_svyranktest <- function(data, by, variables, test, ...) { "method", "alternative" ), passed_args = dots_list(...), - lst_ard_columns = list(group1 = by, variable = variable, context = "svyranktest") + lst_ard_columns = list(group1 = by, variable = variable, context = "survey_svyranktest") ) # add the stat label --------------------------------------------------------- diff --git a/R/ard_survey_svyttest.R b/R/ard_survey_svyttest.R index da2a1c690..2e6ea91d6 100644 --- a/R/ard_survey_svyttest.R +++ b/R/ard_survey_svyttest.R @@ -75,7 +75,7 @@ ard_survey_svyttest <- function(data, by, variables, conf.level = 0.95, ...) { "conf.level", "method", "alternative" ), passed_args = dots_list(...), - lst_ard_columns = list(group1 = by, variable = variable, context = "svyttest") + lst_ard_columns = list(group1 = by, variable = variable, context = "survey_svyttest") ) # add the stat label --------------------------------------------------------- diff --git a/R/ard_survival_survfit.R b/R/ard_survival_survfit.R index eee2764a8..58be3ff2a 100644 --- a/R/ard_survival_survfit.R +++ b/R/ard_survival_survfit.R @@ -240,7 +240,7 @@ ard_survival_survfit <- function(x, times = NULL, probs = NULL, type = NULL) { ) %>% dplyr::bind_rows() %>% `rownames<-`(NULL) %>% - dplyr::mutate(context = "survival") %>% + dplyr::mutate(context = "survival_survfit") %>% dplyr::as_tibble() if (length(x$n) == 1) df_stat <- df_stat %>% dplyr::select(-"strata") diff --git a/tests/testthat/_snaps/ard_car_vif.md b/tests/testthat/_snaps/ard_car_vif.md index 745c24ef3..8d0a7a74b 100644 --- a/tests/testthat/_snaps/ard_car_vif.md +++ b/tests/testthat/_snaps/ard_car_vif.md @@ -4,12 +4,12 @@ as.data.frame(ard_car_vif(lm(AGE ~ ARM + SEX, data = cards::ADSL))) Output variable context stat_name stat_label stat fmt_fn warning error - 1 ARM vif GVIF GVIF 1.015675 1 NULL NULL - 2 ARM vif df df 2.000000 1 NULL NULL - 3 ARM vif aGVIF Adjusted GVIF 1.003896 1 NULL NULL - 4 SEX vif GVIF GVIF 1.015675 1 NULL NULL - 5 SEX vif df df 1.000000 1 NULL NULL - 6 SEX vif aGVIF Adjusted GVIF 1.007807 1 NULL NULL + 1 ARM car_vif GVIF GVIF 1.015675 1 NULL NULL + 2 ARM car_vif df df 2.000000 1 NULL NULL + 3 ARM car_vif aGVIF Adjusted GVIF 1.003896 1 NULL NULL + 4 SEX car_vif GVIF GVIF 1.015675 1 NULL NULL + 5 SEX car_vif df df 1.000000 1 NULL NULL + 6 SEX car_vif aGVIF Adjusted GVIF 1.007807 1 NULL NULL --- @@ -17,8 +17,8 @@ as.data.frame(ard_car_vif(lm(AGE ~ BMIBL + EDUCLVL, data = cards::ADSL))) Output variable context stat_name stat_label stat fmt_fn warning error - 1 BMIBL vif VIF VIF 1.010522 1 NULL NULL - 2 EDUCLVL vif VIF VIF 1.010522 1 NULL NULL + 1 BMIBL car_vif VIF VIF 1.010522 1 NULL NULL + 2 EDUCLVL car_vif VIF VIF 1.010522 1 NULL NULL # ard_car_vif() appropriate errors are given for model with only 1 term @@ -26,10 +26,10 @@ as.data.frame(ard_car_vif(lm(AGE ~ ARM, data = cards::ADSL))) Output variable context stat_name stat_label stat fmt_fn warning - 1 ARM vif VIF VIF NULL NULL NULL - 2 ARM vif GVIF GVIF NULL NULL NULL - 3 ARM vif aGVIF Adjusted GVIF NULL NULL NULL - 4 ARM vif df df NULL NULL NULL + 1 ARM car_vif VIF VIF NULL NULL NULL + 2 ARM car_vif GVIF GVIF NULL NULL NULL + 3 ARM car_vif aGVIF Adjusted GVIF NULL NULL NULL + 4 ARM car_vif df df NULL NULL NULL error 1 model contains fewer than 2 terms 2 model contains fewer than 2 terms diff --git a/tests/testthat/_snaps/ard_effectsize_cohens_d.md b/tests/testthat/_snaps/ard_effectsize_cohens_d.md index 7f3d5732b..6cd20d5a2 100644 --- a/tests/testthat/_snaps/ard_effectsize_cohens_d.md +++ b/tests/testthat/_snaps/ard_effectsize_cohens_d.md @@ -22,13 +22,13 @@ "Xanomeline High Dose")), by = ARM, variables = c(BMIBL, HEIGHTBL)), c(1:3, 5:6)), variable), n = 3)) Output - group1 variable context stat_label stat - 1 ARM BMIBL cohens_d Effect Size Estimate -0.436653 - 2 ARM BMIBL cohens_d CI Confidence Level 0.95 - 3 ARM BMIBL cohens_d CI Lower Bound -0.740282 - 4 ARM HEIGHTBL cohens_d Effect Size Estimate -0.299056 - 5 ARM HEIGHTBL cohens_d CI Confidence Level 0.95 - 6 ARM HEIGHTBL cohens_d CI Lower Bound -0.600975 + group1 variable context stat_label stat + 1 ARM BMIBL effectsize_cohens_d Effect Size Estimate -0.436653 + 2 ARM BMIBL effectsize_cohens_d CI Confidence Level 0.95 + 3 ARM BMIBL effectsize_cohens_d CI Lower Bound -0.740282 + 4 ARM HEIGHTBL effectsize_cohens_d Effect Size Estimate -0.299056 + 5 ARM HEIGHTBL effectsize_cohens_d CI Confidence Level 0.95 + 6 ARM HEIGHTBL effectsize_cohens_d CI Lower Bound -0.600975 # ard_effectsize_paired_cohens_d() works diff --git a/tests/testthat/_snaps/ard_effectsize_hedges_g.md b/tests/testthat/_snaps/ard_effectsize_hedges_g.md index 149f7b705..e06a4ae16 100644 --- a/tests/testthat/_snaps/ard_effectsize_hedges_g.md +++ b/tests/testthat/_snaps/ard_effectsize_hedges_g.md @@ -22,13 +22,13 @@ "Xanomeline High Dose")), by = ARM, variables = c(BMIBL, HEIGHTBL)), c(1:3, 5:6)), variable), n = 3)) Output - group1 variable context stat_label stat - 1 ARM BMIBL hedges_g Effect Size Estimate -0.4347006 - 2 ARM BMIBL hedges_g CI Confidence Level 0.95 - 3 ARM BMIBL hedges_g CI Lower Bound -0.7369717 - 4 ARM HEIGHTBL hedges_g Effect Size Estimate -0.2977188 - 5 ARM HEIGHTBL hedges_g CI Confidence Level 0.95 - 6 ARM HEIGHTBL hedges_g CI Lower Bound -0.5982873 + group1 variable context stat_label stat + 1 ARM BMIBL effectsize_hedges_g Effect Size Estimate -0.4347006 + 2 ARM BMIBL effectsize_hedges_g CI Confidence Level 0.95 + 3 ARM BMIBL effectsize_hedges_g CI Lower Bound -0.7369717 + 4 ARM HEIGHTBL effectsize_hedges_g Effect Size Estimate -0.2977188 + 5 ARM HEIGHTBL effectsize_hedges_g CI Confidence Level 0.95 + 6 ARM HEIGHTBL effectsize_hedges_g CI Lower Bound -0.5982873 # ard_effectsize_paired_hedges_g() works diff --git a/tests/testthat/_snaps/ard_stats_aov.md b/tests/testthat/_snaps/ard_stats_aov.md index fa24cb0d7..3ae9ebce4 100644 --- a/tests/testthat/_snaps/ard_stats_aov.md +++ b/tests/testthat/_snaps/ard_stats_aov.md @@ -3,15 +3,15 @@ Code as.data.frame(ard_stats_aov(AGE ~ ARM + SEX, data = cards::ADSL)) Output - variable context stat_name stat_label stat warning error - 1 ARM aov sumsq Sum of Squares 71.38574 NULL NULL - 2 ARM aov df Degrees of Freedom 2 NULL NULL - 3 ARM aov meansq Mean of Sum of Squares 35.69287 NULL NULL - 4 ARM aov statistic Statistic 0.5235002 NULL NULL - 5 ARM aov p.value p-value 0.5930912 NULL NULL - 6 SEX aov sumsq Sum of Squares 87.40947 NULL NULL - 7 SEX aov df Degrees of Freedom 1 NULL NULL - 8 SEX aov meansq Mean of Sum of Squares 87.40947 NULL NULL - 9 SEX aov statistic Statistic 1.282017 NULL NULL - 10 SEX aov p.value p-value 0.2586091 NULL NULL + variable context stat_name stat_label stat warning error + 1 ARM stats_aov sumsq Sum of Squares 71.38574 NULL NULL + 2 ARM stats_aov df Degrees of Freedom 2 NULL NULL + 3 ARM stats_aov meansq Mean of Sum of Squares 35.69287 NULL NULL + 4 ARM stats_aov statistic Statistic 0.5235002 NULL NULL + 5 ARM stats_aov p.value p-value 0.5930912 NULL NULL + 6 SEX stats_aov sumsq Sum of Squares 87.40947 NULL NULL + 7 SEX stats_aov df Degrees of Freedom 1 NULL NULL + 8 SEX stats_aov meansq Mean of Sum of Squares 87.40947 NULL NULL + 9 SEX stats_aov statistic Statistic 1.282017 NULL NULL + 10 SEX stats_aov p.value p-value 0.2586091 NULL NULL diff --git a/tests/testthat/_snaps/ard_stats_chisq_test.md b/tests/testthat/_snaps/ard_stats_chisq_test.md index c5ad14cf0..d7e819366 100644 --- a/tests/testthat/_snaps/ard_stats_chisq_test.md +++ b/tests/testthat/_snaps/ard_stats_chisq_test.md @@ -5,13 +5,13 @@ by = "ARM", variables = "AGEGR1"), ard_stats_chisq_test(data = adsl_sub, by = "SEX", variables = "AGEGR1")))) Output - ARM SEX variable context stat_name stat - 1 Overall ARM AGEGR1 chisqtest statistic 5.079442e+00 - 2 Overall ARM AGEGR1 chisqtest p.value 7.888842e-02 - 3 Overall ARM AGEGR1 chisqtest parameter 2.000000e+00 - 4 Overall ARM AGEGR1 chisqtest B 2.000000e+03 - 5 Overall SEX AGEGR1 chisqtest statistic 1.039442e+00 - 6 Overall SEX AGEGR1 chisqtest p.value 5.946864e-01 - 7 Overall SEX AGEGR1 chisqtest parameter 2.000000e+00 - 8 Overall SEX AGEGR1 chisqtest B 2.000000e+03 + ARM SEX variable context stat_name stat + 1 Overall ARM AGEGR1 stats_chisq_test statistic 5.079442e+00 + 2 Overall ARM AGEGR1 stats_chisq_test p.value 7.888842e-02 + 3 Overall ARM AGEGR1 stats_chisq_test parameter 2.000000e+00 + 4 Overall ARM AGEGR1 stats_chisq_test B 2.000000e+03 + 5 Overall SEX AGEGR1 stats_chisq_test statistic 1.039442e+00 + 6 Overall SEX AGEGR1 stats_chisq_test p.value 5.946864e-01 + 7 Overall SEX AGEGR1 stats_chisq_test parameter 2.000000e+00 + 8 Overall SEX AGEGR1 stats_chisq_test B 2.000000e+03 diff --git a/tests/testthat/_snaps/ard_stats_kruskal_test.md b/tests/testthat/_snaps/ard_stats_kruskal_test.md index 0b4c1c5ea..21fb6637d 100644 --- a/tests/testthat/_snaps/ard_stats_kruskal_test.md +++ b/tests/testthat/_snaps/ard_stats_kruskal_test.md @@ -3,14 +3,19 @@ Code as.data.frame(ard_stats_kruskal_test(cards::ADSL, by = "ARM", variables = "AGE")) Output - group1 variable context stat_name stat_label - 1 ARM AGE kruskaltest statistic Kruskal-Wallis chi-squared Statistic - 2 ARM AGE kruskaltest p.value p-value - 3 ARM AGE kruskaltest parameter Degrees of Freedom - 4 ARM AGE kruskaltest method method - stat fmt_fn warning error - 1 1.63473 1 NULL NULL - 2 0.4415937 1 NULL NULL - 3 2 1 NULL NULL - 4 Kruskal-Wallis rank sum test NULL NULL NULL + group1 variable context stat_name + 1 ARM AGE stats_kruskal_test statistic + 2 ARM AGE stats_kruskal_test p.value + 3 ARM AGE stats_kruskal_test parameter + 4 ARM AGE stats_kruskal_test method + stat_label stat fmt_fn + 1 Kruskal-Wallis chi-squared Statistic 1.63473 1 + 2 p-value 0.4415937 1 + 3 Degrees of Freedom 2 1 + 4 method Kruskal-Wallis rank sum test NULL + warning error + 1 NULL NULL + 2 NULL NULL + 3 NULL NULL + 4 NULL NULL diff --git a/tests/testthat/_snaps/ard_stats_mood_test.md b/tests/testthat/_snaps/ard_stats_mood_test.md index 8e5db79df..7dfdbc023 100644 --- a/tests/testthat/_snaps/ard_stats_mood_test.md +++ b/tests/testthat/_snaps/ard_stats_mood_test.md @@ -3,11 +3,11 @@ Code as.data.frame(ard_stats_mood_test(cards::ADSL, by = SEX, variable = AGE)) Output - group1 variable context stat_name stat_label - 1 SEX AGE moodtest statistic Z-Statistic - 2 SEX AGE moodtest p.value p-value - 3 SEX AGE moodtest method method - 4 SEX AGE moodtest alternative Alternative Hypothesis + group1 variable context stat_name stat_label + 1 SEX AGE stats_mood_test statistic Z-Statistic + 2 SEX AGE stats_mood_test p.value p-value + 3 SEX AGE stats_mood_test method method + 4 SEX AGE stats_mood_test alternative Alternative Hypothesis stat fmt_fn warning error 1 0.1292194 1 NULL NULL 2 0.8971841 1 NULL NULL diff --git a/tests/testthat/_snaps/ard_stats_t_test.md b/tests/testthat/_snaps/ard_stats_t_test.md index d6873cc22..0b378d374 100644 --- a/tests/testthat/_snaps/ard_stats_t_test.md +++ b/tests/testthat/_snaps/ard_stats_t_test.md @@ -4,36 +4,36 @@ as.data.frame(ard_stats_t_test(cards::ADSL, by = ARM, variable = AGE, var.equal = TRUE)) Output - group1 variable context stat_name stat_label stat fmt_fn warning - 1 ARM AGE ttest estimate Mean Difference NULL NULL NULL - 2 ARM AGE ttest estimate1 Group 1 Mean NULL NULL NULL - 3 ARM AGE ttest estimate2 Group 2 Mean NULL NULL NULL - 4 ARM AGE ttest statistic t Statistic NULL NULL NULL - 5 ARM AGE ttest p.value p-value NULL NULL NULL - 6 ARM AGE ttest parameter Degrees of Freedom NULL NULL NULL - 7 ARM AGE ttest conf.low CI Lower Bound NULL NULL NULL - 8 ARM AGE ttest conf.high CI Upper Bound NULL NULL NULL - 9 ARM AGE ttest method method NULL NULL NULL - 10 ARM AGE ttest alternative alternative NULL NULL NULL - 11 ARM AGE ttest mu H0 Mean 0 1 NULL - 12 ARM AGE ttest paired Paired t-test FALSE NULL NULL - 13 ARM AGE ttest var.equal Equal Variances TRUE NULL NULL - 14 ARM AGE ttest conf.level CI Confidence Level 0.95 1 NULL - error - 1 grouping factor must have exactly 2 levels - 2 grouping factor must have exactly 2 levels - 3 grouping factor must have exactly 2 levels - 4 grouping factor must have exactly 2 levels - 5 grouping factor must have exactly 2 levels - 6 grouping factor must have exactly 2 levels - 7 grouping factor must have exactly 2 levels - 8 grouping factor must have exactly 2 levels - 9 grouping factor must have exactly 2 levels - 10 grouping factor must have exactly 2 levels - 11 grouping factor must have exactly 2 levels - 12 grouping factor must have exactly 2 levels - 13 grouping factor must have exactly 2 levels - 14 grouping factor must have exactly 2 levels + group1 variable context stat_name stat_label stat fmt_fn + 1 ARM AGE stats_t_test estimate Mean Difference NULL NULL + 2 ARM AGE stats_t_test estimate1 Group 1 Mean NULL NULL + 3 ARM AGE stats_t_test estimate2 Group 2 Mean NULL NULL + 4 ARM AGE stats_t_test statistic t Statistic NULL NULL + 5 ARM AGE stats_t_test p.value p-value NULL NULL + 6 ARM AGE stats_t_test parameter Degrees of Freedom NULL NULL + 7 ARM AGE stats_t_test conf.low CI Lower Bound NULL NULL + 8 ARM AGE stats_t_test conf.high CI Upper Bound NULL NULL + 9 ARM AGE stats_t_test method method NULL NULL + 10 ARM AGE stats_t_test alternative alternative NULL NULL + 11 ARM AGE stats_t_test mu H0 Mean 0 1 + 12 ARM AGE stats_t_test paired Paired t-test FALSE NULL + 13 ARM AGE stats_t_test var.equal Equal Variances TRUE NULL + 14 ARM AGE stats_t_test conf.level CI Confidence Level 0.95 1 + warning error + 1 NULL grouping factor must have exactly 2 levels + 2 NULL grouping factor must have exactly 2 levels + 3 NULL grouping factor must have exactly 2 levels + 4 NULL grouping factor must have exactly 2 levels + 5 NULL grouping factor must have exactly 2 levels + 6 NULL grouping factor must have exactly 2 levels + 7 NULL grouping factor must have exactly 2 levels + 8 NULL grouping factor must have exactly 2 levels + 9 NULL grouping factor must have exactly 2 levels + 10 NULL grouping factor must have exactly 2 levels + 11 NULL grouping factor must have exactly 2 levels + 12 NULL grouping factor must have exactly 2 levels + 13 NULL grouping factor must have exactly 2 levels + 14 NULL grouping factor must have exactly 2 levels # ard_stats_paired_t_test() works @@ -42,34 +42,34 @@ dplyr::row_number() == 1L, "3rd ARM", ARM)), by = ARM, variable = AGE, id = USUBJID, var.equal = TRUE)) Output - group1 variable context stat_name stat_label stat fmt_fn warning - 1 ARM AGE ttest estimate Mean Difference NULL NULL NULL - 2 ARM AGE ttest estimate1 Group 1 Mean NULL NULL NULL - 3 ARM AGE ttest estimate2 Group 2 Mean NULL NULL NULL - 4 ARM AGE ttest statistic t Statistic NULL NULL NULL - 5 ARM AGE ttest p.value p-value NULL NULL NULL - 6 ARM AGE ttest parameter Degrees of Freedom NULL NULL NULL - 7 ARM AGE ttest conf.low CI Lower Bound NULL NULL NULL - 8 ARM AGE ttest conf.high CI Upper Bound NULL NULL NULL - 9 ARM AGE ttest method method NULL NULL NULL - 10 ARM AGE ttest alternative alternative NULL NULL NULL - 11 ARM AGE ttest mu H0 Mean 0 1 NULL - 12 ARM AGE ttest paired Paired t-test TRUE NULL NULL - 13 ARM AGE ttest var.equal Equal Variances TRUE NULL NULL - 14 ARM AGE ttest conf.level CI Confidence Level 0.95 1 NULL - error - 1 The `by` argument must have two and only two levels. - 2 The `by` argument must have two and only two levels. - 3 The `by` argument must have two and only two levels. - 4 The `by` argument must have two and only two levels. - 5 The `by` argument must have two and only two levels. - 6 The `by` argument must have two and only two levels. - 7 The `by` argument must have two and only two levels. - 8 The `by` argument must have two and only two levels. - 9 The `by` argument must have two and only two levels. - 10 The `by` argument must have two and only two levels. - 11 The `by` argument must have two and only two levels. - 12 The `by` argument must have two and only two levels. - 13 The `by` argument must have two and only two levels. - 14 The `by` argument must have two and only two levels. + group1 variable context stat_name stat_label stat fmt_fn + 1 ARM AGE stats_t_test estimate Mean Difference NULL NULL + 2 ARM AGE stats_t_test estimate1 Group 1 Mean NULL NULL + 3 ARM AGE stats_t_test estimate2 Group 2 Mean NULL NULL + 4 ARM AGE stats_t_test statistic t Statistic NULL NULL + 5 ARM AGE stats_t_test p.value p-value NULL NULL + 6 ARM AGE stats_t_test parameter Degrees of Freedom NULL NULL + 7 ARM AGE stats_t_test conf.low CI Lower Bound NULL NULL + 8 ARM AGE stats_t_test conf.high CI Upper Bound NULL NULL + 9 ARM AGE stats_t_test method method NULL NULL + 10 ARM AGE stats_t_test alternative alternative NULL NULL + 11 ARM AGE stats_t_test mu H0 Mean 0 1 + 12 ARM AGE stats_t_test paired Paired t-test TRUE NULL + 13 ARM AGE stats_t_test var.equal Equal Variances TRUE NULL + 14 ARM AGE stats_t_test conf.level CI Confidence Level 0.95 1 + warning error + 1 NULL The `by` argument must have two and only two levels. + 2 NULL The `by` argument must have two and only two levels. + 3 NULL The `by` argument must have two and only two levels. + 4 NULL The `by` argument must have two and only two levels. + 5 NULL The `by` argument must have two and only two levels. + 6 NULL The `by` argument must have two and only two levels. + 7 NULL The `by` argument must have two and only two levels. + 8 NULL The `by` argument must have two and only two levels. + 9 NULL The `by` argument must have two and only two levels. + 10 NULL The `by` argument must have two and only two levels. + 11 NULL The `by` argument must have two and only two levels. + 12 NULL The `by` argument must have two and only two levels. + 13 NULL The `by` argument must have two and only two levels. + 14 NULL The `by` argument must have two and only two levels. diff --git a/tests/testthat/_snaps/ard_survey_svychisq.md b/tests/testthat/_snaps/ard_survey_svychisq.md index 5d9b016f3..0d0b49f4d 100644 --- a/tests/testthat/_snaps/ard_survey_svychisq.md +++ b/tests/testthat/_snaps/ard_survey_svychisq.md @@ -5,11 +5,11 @@ ard_survey_svychisq(dclus2, variables = c(sch.wide, stype), by = comp.imp, statistic = "adjWald"), c(1:3, 5:6)), variable), n = 3)) Output - group1 variable context stat_label stat - 1 comp.imp sch.wide svychisq Nominator Degrees of Freedom 1 - 2 comp.imp sch.wide svychisq Denominator Degrees of Freedom 39 - 3 comp.imp sch.wide svychisq Statistic 11.4203 - 4 comp.imp stype svychisq Nominator Degrees of Freedom 2 - 5 comp.imp stype svychisq Denominator Degrees of Freedom 38 - 6 comp.imp stype svychisq Statistic 4.480236 + group1 variable context stat_label stat + 1 comp.imp sch.wide survey_svychisq Nominator Degrees of Freedom 1 + 2 comp.imp sch.wide survey_svychisq Denominator Degrees of Freedom 39 + 3 comp.imp sch.wide survey_svychisq Statistic 11.4203 + 4 comp.imp stype survey_svychisq Nominator Degrees of Freedom 2 + 5 comp.imp stype survey_svychisq Denominator Degrees of Freedom 38 + 6 comp.imp stype survey_svychisq Statistic 4.480236 diff --git a/tests/testthat/_snaps/ard_survey_svycontinuous.md b/tests/testthat/_snaps/ard_survey_svycontinuous.md index ec07ffea5..7dbd96603 100644 --- a/tests/testthat/_snaps/ard_survey_svycontinuous.md +++ b/tests/testthat/_snaps/ard_survey_svycontinuous.md @@ -6,16 +6,16 @@ {cards} data frame: 10 x 8 Output variable context stat_name stat_label stat fmt_fn - 1 api00 continuo… mean Mean 644.169 1 - 2 api00 continuo… median Median 652 1 - 3 api00 continuo… min Minimum 411 1 - 4 api00 continuo… max Maximum 905 1 - 5 api00 continuo… sum Sum 3989985 1 - 6 api00 continuo… var Variance 11182.82 1 - 7 api00 continuo… sd Standard… 105.749 1 - 8 api00 continuo… mean.std.error SE(Mean) 23.542 1 - 9 api00 continuo… deff Design E… 9.346 1 - 10 api00 continuo… p75 75% Perc… 719 1 + 1 api00 survey_s… mean Mean 644.169 1 + 2 api00 survey_s… median Median 652 1 + 3 api00 survey_s… min Minimum 411 1 + 4 api00 survey_s… max Maximum 905 1 + 5 api00 survey_s… sum Sum 3989985 1 + 6 api00 survey_s… var Variance 11182.82 1 + 7 api00 survey_s… sd Standard… 105.749 1 + 8 api00 survey_s… mean.std.error SE(Mean) 23.542 1 + 9 api00 survey_s… deff Design E… 9.346 1 + 10 api00 survey_s… p75 75% Perc… 719 1 Message i 2 more variables: warning, error @@ -29,10 +29,10 @@ {cards} data frame: 4 x 8 Output variable context stat_name stat_label stat fmt_fn - 1 api00 continuo… mean Mean 644.169 2 - 2 api00 continuo… median Median 652 xx.xx - 3 api00 continuo… min Minimum 411 - 4 api00 continuo… max Maximum 905 1 + 1 api00 survey_s… mean Mean 644.169 2 + 2 api00 survey_s… median Median 652 xx.xx + 3 api00 survey_s… min Minimum 411 + 4 api00 survey_s… max Maximum 905 1 Message i 2 more variables: warning, error @@ -46,10 +46,10 @@ {cards} data frame: 4 x 8 Output variable context stat_name stat_label stat fmt_fn - 1 api00 continuo… mean MeAn 644.169 1 - 2 api00 continuo… median MEDian 652 1 - 3 api00 continuo… min MINimum 411 1 - 4 api00 continuo… max Maximum 905 1 + 1 api00 survey_s… mean MeAn 644.169 1 + 2 api00 survey_s… median MEDian 652 1 + 3 api00 survey_s… min MINimum 411 1 + 4 api00 survey_s… max Maximum 905 1 Message i 2 more variables: warning, error diff --git a/tests/testthat/_snaps/ard_survival_survfit.md b/tests/testthat/_snaps/ard_survival_survfit.md index da830d66d..6697507dd 100644 --- a/tests/testthat/_snaps/ard_survival_survfit.md +++ b/tests/testthat/_snaps/ard_survival_survfit.md @@ -119,13 +119,13 @@ Message {cards} data frame: 6 x 9 Output - variable variable_level context stat_name stat_label stat - 1 prob 0.5 survival estimate Survival… 310 - 2 prob 0.5 survival conf.high CI Upper… 363 - 3 prob 0.5 survival conf.low CI Lower… 285 - 4 prob 0.75 survival estimate Survival… 550 - 5 prob 0.75 survival conf.high CI Upper… 654 - 6 prob 0.75 survival conf.low CI Lower… 460 + variable variable_level context stat_name stat_label stat + 1 prob 0.5 survival… estimate Survival… 310 + 2 prob 0.5 survival… conf.high CI Upper… 363 + 3 prob 0.5 survival… conf.low CI Lower… 285 + 4 prob 0.75 survival… estimate Survival… 550 + 5 prob 0.75 survival… conf.high CI Upper… 654 + 6 prob 0.75 survival… conf.low CI Lower… 460 Message i 3 more variables: fmt_fn, warning, error