Description Usage Arguments Details Value Note Author(s) See Also Examples
Reports the statistical significance of the Cramer's V for each varaible pair in the correlation matrix returned by cramersV. Output is in 'long' format with one row per variable pair, allowing the the ordering of variable pairs by variable name or by size or p-value of Cramer's V.
1 | cramersV.results(cormat, sort.by="r", data=NULL, var.name=NULL, na.rm=TRUE)
|
cormat |
The correlation matrix produced by the function |
sort.by |
Indicates the order in which the results are to be reported. See 'Details' for options. |
var.name |
If |
data |
If |
na.rm |
If |
sort.by offers three options. “r” (the default) sorts results in decreasing order of Cramer's V; “x” sorts results in alphabetic order of the x variable; “y” sorts results in alphabetic order of the y variable.
A dataframe reporting, for each variable pair:
r |
Cramer's V |
p.value |
p-value [if |
sig |
level of statistical significance ( |
Adapted from http://www.sthda.com/english/wiki/correlation-matrix-an-r-function-to-do-all-you-need
Paul Williamson
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # Default (using results from cramersV)
res <- cramersV(survey[, 3:8], fill=FALSE)
cramersV.results(res) # by default, results sorted by Cramer's V (r)
# Sort results by variable name
cramersV.results( res, sort.by = "x" )
cramersV.results( res, sort.by = "y" )
# Reports only those results involving a specified variable
cramersV.results( res, var.name = "Tenure" )
# Report p-value and significance level
cramersV.results( res, data = survey[ , 3:8] )
cramersV.results( res, data = survey[ , 3:8], sort.by = "p.value" )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.