I calculated the Spearman correlation between two matrices and I'm plotting the r values using corrplot
. How can I plot only the significant correlations (so only those correlations having p value lower than 0.00 and delete those having higher p value, even if are strong correlations - high value of r). I generated the correlation matrix using corr.test
in psych
package, so I already have the p values in cor.matrix$p
This is the code I'm using:
library(corrplot)
library(psych)
corr.test(mydata_t1, mydata_t2, method="spearman")
M <- corrplot(cor.matrix$r, method="square",type="lower",col=col1(100),is.corr=T,mar=c(1,1,1,1),tl.cex=0.5)
How can I modify it to plot only significant corelations?