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.

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to