diff --git a/R/ard_continuous.survey.design.R b/R/ard_continuous.survey.design.R index 306e37217..3d3a67c39 100644 --- a/R/ard_continuous.survey.design.R +++ b/R/ard_continuous.survey.design.R @@ -122,7 +122,7 @@ ard_continuous.survey.design <- function(data, variables, by = NULL, unlist()) ) |> tidyr::unnest(cols = c("stat_name", "stat_label")), - by = "stat_name", + by = c("variable", "stat_name"), unmatched = "ignore" ) } diff --git a/man/ard_dichotomous.survey.design.Rd b/man/ard_dichotomous.survey.design.Rd index f2fddcd73..7dd2ce697 100644 --- a/man/ard_dichotomous.survey.design.Rd +++ b/man/ard_dichotomous.survey.design.Rd @@ -13,8 +13,8 @@ "N_unweighted", "p_unweighted"), denominator = c("column", "row", "cell"), fmt_fn = NULL, - stat_label = everything() ~ everything() ~ list(p = "\%", p.std.error = "SE(\%)", deff - = "Design Effect", n_unweighted = "Unweighted n", N_unweighted = "Unweighted N", + stat_label = everything() ~ list(p = "\%", p.std.error = "SE(\%)", deff = + "Design Effect", n_unweighted = "Unweighted n", N_unweighted = "Unweighted N", p_unweighted = "Unweighted \%"), ... ) diff --git a/tests/testthat/_snaps/ard_continuous.survey.design.md b/tests/testthat/_snaps/ard_continuous.survey.design.md index dfa6ed908..526af04b7 100644 --- a/tests/testthat/_snaps/ard_continuous.survey.design.md +++ b/tests/testthat/_snaps/ard_continuous.survey.design.md @@ -38,17 +38,17 @@ # ard_continuous.survey.design(stat_label) Code - ard_continuous(dclus1, variables = api00, statistic = ~ c("mean", "median", - "min", "max"), stat_label = list(api00 = list(mean = "MeAn", median = "MEDian", - min = "MINimum"))) - Message - {cards} data frame: 4 x 8 + as.data.frame(ard_continuous(dclus1, variables = c(api00, api99), statistic = ~ + c("mean", "median", "min", "max"), stat_label = list(api00 = list(mean = "MeAn", + median = "MEDian", min = "MINimum")))) 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 - Message - i 2 more variables: warning, error + variable context stat_name stat_label stat fmt_fn warning error + 1 api00 continuous mean MeAn 644.1694 1 NULL NULL + 2 api00 continuous median MEDian 652 1 NULL NULL + 3 api00 continuous min MINimum 411 1 NULL NULL + 4 api00 continuous max Maximum 905 1 NULL NULL + 5 api99 continuous mean Mean 606.9781 1 NULL NULL + 6 api99 continuous median Median 615 1 NULL NULL + 7 api99 continuous min Minimum 365 1 NULL NULL + 8 api99 continuous max Maximum 890 1 NULL NULL diff --git a/tests/testthat/test-ard_continuous.survey.design.R b/tests/testthat/test-ard_continuous.survey.design.R index 5b999d918..95232a5c1 100644 --- a/tests/testthat/test-ard_continuous.survey.design.R +++ b/tests/testthat/test-ard_continuous.survey.design.R @@ -336,10 +336,11 @@ test_that("ard_continuous.survey.design(stat_label)", { expect_snapshot( ard_continuous( dclus1, - variables = api00, + variables = c(api00, api99), statistic = ~ c("mean", "median", "min", "max"), stat_label = list(api00 = list(mean = "MeAn", median = "MEDian", min = "MINimum")) - ) + ) |> + as.data.frame() ) })