[R] ugly loop

Bill Simpson William.Simpson at drdc-rddc.gc.ca
Fri Apr 22 14:58:55 CEST 2005


The following code is slow and ugly:

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

Please help me make it better.

Thanks!

Bill




More information about the R-help mailing list