Take a look at the examples of corrplot. do ?corrplot
. It has options for doing what you want.
You can plot the p-values on the graph itself, which I think is better than putting stars,
as people not familiar with that terminology have one more thing to look up.
to put p-values on graph do this corrplot(cor.matrix$r, p.mat = cor.matrix$p, insig = "p-value")
where cor.matrix is object holding the result of cor.test.
The insig
option can put:
- p-values (as shown above)
- blank out insignificant correlations with corrplot(cor.matrix$r, p.mat = cor.matrix$p, insig = "blank")`
- Cross out (put a X on) insignificant correlations) with option
corrplot(cor.matrix$r, p.mat = cor.matrix$p, insig = "pch")
(DEFAULT) - Do nothing with to the plot, with
corrplot(cor.matrix$r, p.mat = cor.matrix$p, insig = "n")
If you do want stars, p-value on the correlation matrix plot - take a look at this thread Correlation Corrplot Configuration
Though I have to say I really like @sven hohenstein's elegant subset solution.