Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I create a correlation matrix in R?

I have 92 set of data of same type.

I want to make a correlation matrix for any two combinations possible.

i.e., I want a matrix of 92x92.

such that element (ci,cj) should be correlation between ci and cj.

How do I do that?

like image 863
Swapnil 'Tux' Takle Avatar asked May 21 '12 06:05

Swapnil 'Tux' Takle


Video Answer


1 Answers

An example,

 d &lt- data.frame(x1=rnorm(10),                  x2=rnorm(10),                  x3=rnorm(10)) cor(d) # get correlations (returns matrix) 
like image 195
Manuel Ramón Avatar answered Oct 05 '22 16:10

Manuel Ramón