[R] ugly loop

Bill Simpson William.Simpson at drdc-rddc.gc.ca
Fri Apr 22 15:17:29 CEST 2005


To clarify: I want to get rid of the loop over i,j
Here is a simpler example. ver is a 2D matrix

count<-0
for(i in 1:nrow(ver))
  for(j in 1:ncol(ver))
    {
    count<-count+1
    x[count]<-ver[i,j]
    }

Bill




More information about the R-help mailing list