cb_summarize_text() generates a summary table for all character variables
from a codebook object, including number of unique values, frequencies for the
most common values, and missing value information. Note that character variables
of class "haven_labelled" are treated as categorical; see cb_summarize_categorical().
Usage
cb_summarize_text(
cb,
n_text_vals = 5,
detail_missing = TRUE,
detail_na_label = "NA",
warn_if_none = TRUE
)Arguments
- cb
An object of class
"li_codebook"as produced bycb_create()or a variant.- n_text_vals
How many unique non-missing values should be included for each variable?
- detail_missing
Include detailed missing value information?
- detail_na_label
Label used for
NAvalues whendetail_missingisTRUE.- warn_if_none
Should a warning be issued if there are no text variables in
cb?
Value
If there no text variables in cb, NULL. Otherwise, a tibble with
columns:
name: variable namelabel_stem: optional column containing variable label stems; included ifcbincludes alabel_stemcolumn and at least one character variable has a non-missing label stem.label: variable labelunique_n: number of unique non-missing valuesis_missing: optional column indicating ifvalueis a missing value. Included ifdetail_missingisTRUE.value: the most prevalent unique values for the variable. If there are more thann_text_vals+ 1 unique values, then_text_valsmost common non-missing values will be included. (All missing values will always be included.)n: number of observationspct_of_all: proportion of all (non-missing and missing) observationspct_of_valid: for non-missing values, proportion of all non-missing observationspct_of_missing: optional column showing, for missing values, proportion of all missing observations. Included ifdetail_missingisTRUE.