[R] Vectorize multiple loops

Kohleth Chia kohleth at gmail.com
Fri Jan 29 12:58:24 CET 2010


Hi,

How can we vectorize multiple for loops?

E.g. how do you vectorize this:

for (i in 1:10){
 for(j in 1:25){
  for(k in 1:19){
   x[i,j,k]=i*k-j
  }
 }
}

THanks
------------
KC



More information about the R-help mailing list