[R] Can I avoid loop?
tlorino@vet-alfort.fr
tlorino at vet-alfort.fr
Tue Jul 2 11:22:48 CEST 2002
Dear R-users,
I have a program to realize (big) simulations... I'm building a matrix, where the
number of rows is a parameter (say N) and the number of columns is fixed. All the matrix
can be completed avoiding loops... excepted one, I think: for the 12th column,
on the i-th row, I need something like
matrix[1,12]_0
for (i in 1:N)
matrix[i,12]_ifelse(matrix[i,1]>0, matrix[i-1,12] + ..., 0)
The values in the row i depends on the (i-1)th row only for the 12th column... Is it possible
to avoid a "for" loop here?
Thank you,
Tristan Lorino
----------------------
École Nationale Vétérinaire d'Alfort - http://www.vet-alfort.fr,
Tél. 01 43 96 70 33
Mél. tlorino at vet-alfort.fr
Site personnel : http://daedale.free.fr
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list