[R] ugly loop

From: Bill Simpson <William.Simpson_at_drdc-rddc.gc.ca>
Date: Fri 22 Apr 2005 - 22:58:55 EST


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



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 Received on Fri Apr 22 23:05:44 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:22 EST