[R] Statemement by recurrence avoiding loop

Laurent Gautier laurent at cbs.dtu.dk
Mon Jul 8 11:00:04 CEST 2002


Did you try 'cumsum' ?


Hopin' it helps,



L.


On Mon, Jul 08, 2002 at 09:47:10AM +0200, 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

-- 
--------------------------------------------------------------
Laurent Gautier			CBS, Building 208, DTU
PhD. Student			DK-2800 Lyngby,Denmark	
tel: +45 45 25 24 85		http://www.cbs.dtu.dk/laurent
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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