[R] an efficient way to calculate correlation matrix

Bill Hyman billhyman1 at yahoo.com
Thu Jun 2 17:48:11 CEST 2011


Dear all,

I have a problem. I have m variables each of which has n observations. I want to 
calculate pairwise correlation among the m variables and store the values in a m 
x m matrix. It is extremely slow to use nested 'for' loops if m and n are large. 
Is there any efficient alternative to do this? Many thanks for your 
suggestions!!

Bill



More information about the R-help mailing list