corr.test
in the psych
package is designed to do this:
library("psych")
data(sat.act)
corr.test(sat.act)
As noted in the comments, to replicate the p-values from the base cor.test()
function over the entire matrix, then you need to turn off adjustment of the p-values for multiple comparisons (the default is to use Holm’s method of adjustment):
corr.test(sat.act, adjust = "none")
[But be careful when interpreting those results!]