[R] Statemement by recurrence avoiding loop

Shawn Lee Shawn.Lee at asml.com
Mon Jul 8 10:27:09 CEST 2002


Please check the ?cumsum.

cumsum[x[,,j])[i]

Kind Regards, Shawn Lee


tlorino at vet-alfort.fr wrote:

> Dear R users,
>
> I would like to calculate a cumulative sum as following: on the i-th row, in the
> j-th column of a matrix, I would like to obtain the sum of the (i-1) preceding elements of
> this j-th column.
> Could I avoid a "for" loop?
>
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Shawn.Lee.vcf
Type: text/x-vcard
Size: 339 bytes
Desc: Card for Shawn Lee
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20020708/96da6271/Shawn.Lee.vcf


More information about the R-help mailing list