Compute Analysis Results Data (ARD) for statistics related to data missingness for survey objects
# S3 method for class 'survey.design'
ard_missing(
data,
variables,
by = NULL,
statistic = everything() ~ c("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"),
fmt_fn = NULL,
stat_label = 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)"),
...
)
(survey.design
)
a design object often created with survey::svydesign()
.
(tidy-select
)
columns to include in summaries.
(tidy-select
)
results are calculated for all combinations of the column specified
and the variables. A single column may be specified.
(formula-list-selector
)
a named list, a list of formulas,
or a single formula where the list element is a character vector of
statistic names to include. See default value for options.
(formula-list-selector
)
a named list, a list of formulas,
or a single formula where the list element is a named list of functions
(or the RHS of a formula),
e.g. list(mpg = list(mean = \(x) round(x, digits = 2) |> as.character()))
.
(formula-list-selector
)
a named list, a list of formulas, or a single formula where
the list element is either a named list or a list of formulas defining the
statistic labels, e.g. everything() ~ list(mean = "Mean", sd = "SD")
or
everything() ~ list(mean ~ "Mean", sd ~ "SD")
.
These dots are for future extensions and must be empty.
an ARD data frame of class 'card'
svy_titanic <- survey::svydesign(~1, data = as.data.frame(Titanic), weights = ~Freq)
ard_missing(svy_titanic, variables = c(Class, Age), by = Survived)
#> {cards} data frame: 40 x 10
#> group1 group1_level variable stat_name stat_label stat
#> 1 Survived No Class N_nonmiss N not Mi… 1490
#> 2 Survived No Class N_obs Total N 1490
#> 3 Survived No Class p_nonmiss % not Mi… 1
#> 4 Survived No Class N_miss N Missing 0
#> 5 Survived No Class p_miss % Missing 0
#> 6 Survived No Age N_nonmiss N not Mi… 1490
#> 7 Survived No Age N_obs Total N 1490
#> 8 Survived No Age p_nonmiss % not Mi… 1
#> 9 Survived No Age N_miss N Missing 0
#> 10 Survived No Age p_miss % Missing 0
#> ℹ 30 more rows
#> ℹ Use `print(n = ...)` to see more rows
#> ℹ 4 more variables: context, fmt_fn, warning, error