View source: R/T_hss_table_multi.R
T_hss_table_multi | R Documentation |
Create contingency tables for HSS questions with multiple response options and a cross-variable. This function requires only a single question variable as input and looks up the corresponding response variables. Tables can be created with either counts or percentages and the number of significant digits for percentages can be set. Tables created with this function come with a couple of additions according to HSS preferences. Most notably: sums are added over columns, N-values are added to column headers, and a column containing p-values for chi-squared statistical test for each response option is added.
T_hss_table_multi(df, var, group, percent = TRUE, digits = 1)
df |
The dataframe containing the multiresponse questions |
var |
The name of the question variable. |
group |
A grouping (or disaggregation) variable. |
percent |
Set to TRUE to show percentages. Set to FALSE to show counts |
digits |
The number of (significant) digits to display. Trailing zeroes are always removed. Note that 'digits' does not mean 'decimals', so digits = 3 will display as 'mm.d' not 'mm.ddd' |
A contingency table containing the multiresponse answers and a grouping variable
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.