Description Arguments Details Value Examples
Easily produced one and two-way tables for categorical questions accompanied by a barplot
afro |
An afrobarometer dataframe |
question |
A string specifying the dependent varirable to examine |
question2 |
A string specifying the independent variable to examine |
miss |
A boolean specifying whether or not to include missing/don't know/refused responses (default FALSE) |
digits |
An integer specifying number of digits to round to (default is 2) |
pos |
For two variables, specifies the style of the barplot: "stack" or "dodge" (default) |
If a cross-tab, also performs a chi-square test
A table object of the proportion table or cross-tab
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # For question 5: Produce a table of percentages, a table of raw numbers,
# and a barplot of responses, dropping missing/don't know/refused responses
afro %>% af_tab("q5")
# For question 5: Produces a table of percentages, a table of raw numbers,
# and a barplot of responses, including missing/don't know/refused responses
# afro %>% af_tab("q5", miss=T)
# For questions 5 & 7: Produces a cross-tab table of proportions,
# a table of raw numbers, and a side-by-side barplot of responses,
# dropping missing/don't know/refused responses
afro %>% af_tab("q5", "q7")
# For questions 5 & 7: Produces a cross-tab table of proportions,
# a table of raw numbers, and a stacked barplot of responses,
# dropping missing/don't know/refused responses
afro %>% af_tab("q5", "q7", pos="stack")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.