corPrint | R Documentation |
Display a correlation matrix in readable, compact form.
corPrint(R, min_value=0)
R |
Square, input correlation matrix. |
min_value |
The minimal value in magnitude of the displayed correlations. |
Drop the 0.
characters of each displayed correlation coefficient. For example, display 0.42 as 42. Have an option to only display correlations larger in magnitude than a minimum threshold, so that all correlations between -min_value
and +min_value
display as blank spaces.
The output correlation matrix.
David W. Gerbing (Portland State University; gerbing@pdx.edu)
Correlation
, corReorder
.
mycor <- matrix(nrow=6, ncol=6, byrow=TRUE,
c(1.000,0.480,0.320,0.192,0.144,0.096,
0.480,1.000,0.240,0.144,0.108,0.072,
0.320,0.240,1.000,0.096,0.072,0.048,
0.192,0.144,0.096,1.000,0.480,0.320,
0.144,0.108,0.072,0.480,1.000,0.240,
0.096,0.072,0.048,0.320,0.240,1.000))
colnames(mycor) <- c("X1", "X2", "X3", "X4", "X5", "X6")
rownames(mycor) <- colnames(mycor)
# display all the correlations
corPrint(mycor)
# only display correlations in magnitude of 0.2 or larger
corPrint(mycor, min_value=.2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.