This function maps tab() across all variables in a data frame.
Optionally, you can specify a y variable for crosstabs and/or exclude variables from being tabulated.
Additional arguments are passed to tab().
Arguments
- data
A data frame containing the survey data.
- y
(Optional) A variable to cross-tabulate against all
xvariables.- exclude
Variables to exclude from tabulation. Defaults to
NULL. Always excludesy(if specified),weight(if specified), and variable literally named "weight".- ...
Additional arguments passed to
tab().
Examples
# Unweighted proportions tables of all questions
tab_all(data = survey_data)
#> Error: These packages are required but not installed: dplyr
# Weighted proportions crosstabs of all questions by region, excluding Q99
tab_all(data = survey_data, y = region, weight = weight_var, exclude = "Q99")
#> Error: These packages are required but not installed: dplyr
