cramer_v {rstatix} | R Documentation |
Compute Cramer's V
Description
Compute Cramer's V, which measures the strength of the association between categorical variables.
Usage
cramer_v(x, y = NULL, correct = TRUE, ...)
Arguments
x |
a numeric vector or matrix. |
y |
a numeric vector; ignored if |
correct |
a logical indicating whether to apply continuity
correction when computing the test statistic for 2 by 2 tables: one
half is subtracted from all |
... |
other arguments passed to the function
|
Examples
# Data preparation
df <- as.table(rbind(c(762, 327, 468), c(484, 239, 477)))
dimnames(df) <- list(
gender = c("F", "M"),
party = c("Democrat","Independent", "Republican")
)
df
# Compute cramer's V
cramer_v(df)
[Package rstatix version 0.7.2 Index]