[R] "recursive" vectorized arithmetics

Boguslaw Kluge bogklug at mimuw.edu.pl
Tue Jul 24 14:46:16 CEST 2007


 	Hi,

 	I would like to write something similar to:
for(t in 1:100)
 	v[x[t]] <- v[y[t]] + v[z[t]]
in a vectorized form. The x, y, and z vectors may contain duplicates (so v[x] <- v[y] + v[z] has different semantics). The for loop is not efficient enough for my purposes and I would like to avoid using C/Fortran.

 	This problem occurred to me on several occasions and I feel it is quite general. Does anyone have an idea how to solve it nicely?

 	Thanks,
 	bk



More information about the R-help mailing list