Skip to contents

Standard broom::tidy() and broom::glance() interfaces for an object returned by table_categorical(). They re-shape the underlying long-format data (stored on the object as the "long_data" attribute) into the two canonical broom views so the table can be consumed by any downstream tidyverse-stats pipeline.

Usage

# S3 method for class 'spicy_categorical_table'
tidy(x, ...)

# S3 method for class 'spicy_categorical_table'
glance(x, ...)

Arguments

x

A spicy_categorical_table returned by table_categorical().

...

Currently ignored. Present for compatibility with the broom::tidy() / broom::glance() generics.

Value

A tbl_df (when tibble is installed) or a plain data.frame.

Details

tidy() returns one row per (variable x level) – or per (variable x level x group) when by is used – with broom-conventional columns: outcome, level, group (when applicable), n, proportion (the percentage divided by 100).

glance() returns one row per outcome with the omnibus chi-squared test (when by is used) and the requested association measure: outcome, test_type ("chi_squared"), statistic (chi-squared), df, p.value, assoc_type, assoc_value, assoc_ci_lower, assoc_ci_upper, n_total. Without by, only outcome and n_total are populated; the other columns are NA.

See also

as.data.frame.spicy_categorical_table() for the raw wide-format access; tidy.spicy_continuous_table() for the continuous-descriptive companion.