Skip to content
Prev 276286 / 398506 Next

optimising a loop

Try replacing your for loop with the line
   loop[cbind(as.vector(row(voisin)), match(voisin, nom.plac2))] <- as.vector(wei2)

Look help(Subscript) to see how subscripting an n-way array by
an n-column integer matrix works.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com