I use the following method to calculate a correlation of my dataset:
cor( var1, var2, method = \"method\")
But I like to create a correlation m
See corr.test
function in psych
package:
> corr.test(mtcars[1:4])
Call:corr.test(x = mtcars[1:4])
Correlation matrix
mpg cyl disp hp
mpg 1.00 -0.85 -0.85 -0.78
cyl -0.85 1.00 0.90 0.83
disp -0.85 0.90 1.00 0.79
hp -0.78 0.83 0.79 1.00
Sample Size
mpg cyl disp hp
mpg 32 32 32 32
cyl 32 32 32 32
disp 32 32 32 32
hp 32 32 32 32
Probability value
mpg cyl disp hp
mpg 0 0 0 0
cyl 0 0 0 0
disp 0 0 0 0
hp 0 0 0 0
And yet another shameless self-advert: https://gist.github.com/887249