Skip to content
Prev 109330 / 398500 Next

processing a large matrix

Given the response by Carles Berry, you should probably really think
about what you want to do with the results (I'm hoping that you do not
plan to look at every R^2 value personally).  For instance if you want
to find which variable gives the highest R^2 value for each variable,
then this approach may work better:

myR2fun <- function(i){
  cat("\r",i)     # optional
  flush.console() # optional
 tmp <- cor( mymat[,i], mymat[,-i] )^2
 which.max(tmp)
}

out <- sapply( 1:30000, myR2fun )