Tidying methods for a spicy_categorical_svy_table
Source: R/table_categorical_svy_print.R
tidy.spicy_categorical_svy_table.RdStandard broom::tidy() and broom::glance() interfaces for an
object returned by table_categorical_svy().
Usage
# S3 method for class 'spicy_categorical_svy_table'
tidy(x, ...)
# S3 method for class 'spicy_categorical_svy_table'
glance(x, ...)Arguments
- x
A
spicy_categorical_svy_tablereturned bytable_categorical_svy().- ...
Ignored, for S3 compatibility.
Details
tidy() returns one row per (variable x level x column block), which
is the LONG reading of a table whose blocks are columns, in the order
of the table (variable, then level, then block). Columns: variable,
label, level, .row_role (the role of level: "missing" on the
row of missing values the table adds, "level" otherwise), group
(the by level, or the margin, NA without by), .group_role (the
role of group: "group", "missing" for the column of missing by
values, "total" for the margin, NA without by), total (whether
that block is the margin),
n (observed), proportion (the estimated proportion, between 0 and
1), conf.low, conf.high (its interval, on the same scale), deff.
The header rows carry no level statistic and do not appear; their
p-value is what glance() is for.
glance() returns one row per variable: variable, label,
n_levels, test_type (the svychisq() statistic of the test,
chisq_statistic; NA where no test ran), p.value, degf (the
design's own), nobs, nobs_valid, weighted_nobs and
weighted_nobs_valid. The four counts leave out the rows of zero
weight, and levels_keep changes none of them:
nobscounts the rows of the variable in the table, unweighted, the base of the estimates underpercent_base = "total": every row underdrop_na = FALSE, those of the(Missing)row included, and the observed values underdrop_na = TRUE;nobs_validcounts the rows with an observed value, the base underpercent_base = "valid"; it isnobsunderdrop_na = TRUE;weighted_nobsandweighted_nobs_validare the sums of the sampling weights of the same rows.
n_levels counts the levels the TABLE displays, so a (Missing)
display level counts; the test behind p.value runs on the complete
cases and the observed levels only, as it does in
table_categorical().