Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ddsjoberg committed Jun 14, 2024
1 parent 9c5e3e3 commit 43ee82e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
13 changes: 10 additions & 3 deletions R/ard_missing.survey.design.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,16 @@ ard_missing.survey.design <- function(data,
"p_miss_unweighted", "p_nonmiss_unweighted"),
fmt_fn = NULL,
stat_label =
everything() ~ list("N_obs", "N_miss", "N_nonmiss", "p_miss", "p_nonmiss",
"N_obs_unweighted", "N_miss_unweighted", "N_nonmiss_unweighted",
"p_miss_unweighted", "p_nonmiss_unweighted"),
everything() ~ list(N_obs = "Total N",
N_miss = "N Missing",
N_nonmiss = "N not Missing",
p_miss = "% Missing",
p_nonmiss = "% not Missing",
N_obs_unweighted = "Total N (unweighted)",
N_miss_unweighted = "N Missing (unweighted)",
N_nonmiss_unweighted = "N not Missing (unweighted)",
p_miss_unweighted = "% Missing (unweighted)",
p_nonmiss_unweighted = "% not Missing (unweighted)"),
...) {
set_cli_abort_call()
check_dots_empty()
Expand Down
2 changes: 2 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ reference:
- contents:
- ard_continuous.survey.design
- ard_categorical.survey.design
- ard_dichotomous.survey.design
- ard_missing.survey.design
- ard_attributes.survey.design
- ard_survey_svychisq
- ard_survey_svyranktest
Expand Down
7 changes: 6 additions & 1 deletion man/ard_missing.survey.design.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion tests/testthat/test-ard_categorical.survey.design.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
# - It turns out variables (both by and variables) that only have one level are problematic in some ways.
# I've coded around these issues, but we need thorough testing when either by or a variable has a single level.
# We need tests for when these variables are factor, logical, and other to ensure every case is handled properly.
# - A trick to test survey data is to take a normal data frame, convert it to survey using equal weights. Then all the results should equal the unweighted summariess
# - A trick to test survey data is to take a normal data frame, convert it to survey using equal weights.
# Then all the results should equal the unweighted summaries and we can perform expect_equal() checks against the data.frame S3 methods.
# dplyr::tibble(y = rep(FALSE, 15), x = rep(TRUE, 15)) |>
# survey::svydesign(ids = ~1, data = _, weights = ~1) |>
# ard_categorical(by = y)
Expand Down

0 comments on commit 43ee82e

Please sign in to comment.