This function creates a tibble that summarizes missing data
with survey weights for missing counts and proportions. (Apart from
that, it recreates the naniar::miss_var_summary()
output.)
svy_miss_var_summary(
svy_data,
...,
.any_missing = TRUE,
.include_complete = FALSE
)
A survey object created with the survey package
Variables to consider. By default this looks at the whole dataset.
Otherwise, this should be one or more unquoted expressions separated by commas, or
a tidyselect helper function (e.g., starts_with()
or where(is.numeric)
).
Should a row be shown at the start of the return with the number and share of (weighted) responses that have missing data on at least one of the variables considered? Defaults to TRUE.
Should variables with no missing data be included in the returned tibble? Defaults to FALSE.
library(survey)
data(api)
svy_df <- svydesign(id = ~1, strata = ~stype, weights = ~pw,
data = apistrat, fpc = ~fpc)
svy_miss_var_summary(svy_df, acs.core, target, name)
#> # A tibble: 3 × 3
#> variable n_miss pct_miss
#> <chr> <dbl> <dbl>
#> 1 .any_missing 4238 0.684
#> 2 acs.core 4132 0.667
#> 3 target 725 0.117