I would like to compare every column in my matrix with every other column and get the r-squared. I have been using the following formula and loops: summary(lm(matrix[,x]~matrix[,y]))$r.squared where x and y are the looping column numbers
If I have 100 columns (10,000 iterations), the loops give me results in a reasonable time. If I try 10,000 columns, the loops take forever even if there is no formula inside. I am guessing I can vectorize my code so that I could eliminate one or both loops. Unfortunately, I can't figure out how to. Any suggestions? Thanks. -- View this message in context: http://www.nabble.com/loop-issues-%28r.squared%29-tf3195843.html#a8873580 Sent from the R help mailing list archive at Nabble.com. ______________________________________________ [email protected] 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.
