Computes the Cramer's V statistic and Chisquare p value between two categorical variables in data.frame.
cramer(dfm, x, y)
data.frame. probability distributions.
character. name of categorical or discrete variable.
character. name of another categorical or discrete variable.
data.frame. It has the following variables.:
var1 : character. first variable name.
var2 : character. second variable name.
chisq : numeric. Chisquare statistic.
df : integer. degree of freedom.
pval : numeric. p value of Chisquare test.
coef_corr : numeric. Cramer's V statistic.
cramer(mtcars, "gear", "carb")
#> Warning: Chi-squared approximation may be incorrect
#> var1 var2 chisq df pval coef_corr
#> 1 gear carb 16.5181 10 0.08573092 0.5080307