[R] processing a large matrix

andy1983 andy1983 at excite.com
Mon Feb 12 21:55:09 CET 2007


I would like to compare every column in my matrix with every other column and
get the r-squared.

I tried using the following formula and looping through every column:
> summary(lm(matrix[,x]~matrix[,y]))$r.squared
If I have 10,000 columns, the loops (10,000 * 10,000) take forever even if
there is no formula inside.

Then, I attempted to vectorize my code:
> cor(matrix)^2
With 10,000 columns, this works great. With 30,000, R tells me it cannot
allocate vector of that length even if the memory limit is set to 4 GBs.

Is there anything else I can do to resolve this issue?

Thanks.
-- 
View this message in context: http://www.nabble.com/processing-a-large-matrix-tf3216447.html#a8932591
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list