Professional Documents
Culture Documents
Correlation Plots Using corrplot Package Comments (–) Share Hide Toolbars
melike
Let’s say we have a 25-column matrix and we want to analyse and visualize the correlation between columns. There
are several possible ways. This post is about using the corrplot package.
mat[1:5,1:5]
dim(mat)
## [1] 100 25
class(mat)
## [1] "matrix"
The first step is calculating the correlations. Note that I use Spearman’s Rank Correlation Coefficients. This is just
because I use a simulated data and not quite sure if there are outliers.
corr_mat=cor(mat,method="s")
corr_mat[1:5,1:5]
Manual inspection of a 25x25 matrix is time-consuming and uninformative. Thus, we need a better way to visualize
the results.
library(corrplot)
corrplot(corr_mat)
https://rpubs.com/melike/corrplot 1/2
11/23/2018 RPubs - Correlation Plots Using "corrplot" Package
https://rpubs.com/melike/corrplot 2/2