Description Usage Arguments Details Value Examples
crosstab
returns a tibble containing a weighted crosstab of two variables
1 2 3 4 5 6 7 8 9 10 11 |
df |
The data source |
x |
The independent variable |
y |
The dependent variable |
weight |
The weighting variable |
remove |
An optional character vector of values to remove from final table (e.g. "refused"). This will not affect any calculations made. The vector is not case-sensitive. |
n |
logical, if TRUE numeric totals are included. They are included in a separate column for row and cell percentages, but in a separate row for wide format column percentages. |
pct_type |
Controls the kind of percentage values returned. One of "row," "cell," or "column." |
format |
one of "long" or "wide" |
unwt_n |
logical, if TRUE a column "unweighted_n" is included containing the unweighted frequency count. It is not available when pct_type is "column" |
Options include row, column, or cell percentages. The tibble can be in long or wide format.
a tibble
1 2 |
# A tibble: 2 x 6
voter White Black Hispanic Other n
<fct> <dbl> <dbl> <dbl> <dbl> <dbl>
1 Voted 76.4 15.5 5.48 2.61 56230937.
2 Not voted 74.1 10.8 10.3 4.83 32070164.
# A tibble: 2 x 5
voter White Black Hispanic Other
<fct> <dbl> <dbl> <dbl> <dbl>
1 Voted 76.4 15.5 5.48 2.61
2 Not voted 74.1 10.8 10.3 4.83
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.