cat_compare: Investigate association between two categorical variables
Description
cat_compare gives details about the association between two categorical variables.
Usage
cat_compare(x, y, plot = TRUE)
Value
Returns a list including (1) two-way table of counts, (2) chi-squared test for independence, (3) Cramer's V standardized effect, and (4) ggplot2 column plot of proportions conditional on x, if requested.
The table of counts will include missing values of both variables, but these rows/columns are discarded prior to the chi-squared test and Cramer's V calculations.
Arguments
x
A categorical variable: the predictor or group variable, if appropriate
y
A categorical variable: the outcome, if appropriate
plot
Logical. Whether a mosaic plot should be drawn
Details
Strictly, x and y do not need to be factors but will be coerced into factors.