[R] cumsum
ONKELINX, Thierry
Thierry.ONKELINX at inbo.be
Mon Nov 5 09:58:49 CET 2007
apply(matrix, 2, cumsum)
------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
Thierry.Onkelinx op inbo.be
www.inbo.be
Do not put your faith in what statistics say until you have carefully
considered what they do not say. ~William W. Watt
A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney
-----Oorspronkelijk bericht-----
Van: r-help-bounces op r-project.org [mailto:r-help-bounces op r-project.org]
Namens threshold
Verzonden: zaterdag 3 november 2007 12:42
Aan: r-help op r-project.org
Onderwerp: [R] cumsum
Hi, my problem belongs to the basic ones. I want to get cumulated sum
over the matrix columns by one command (if such exists). Ordinary R's
cumsum(x) when x is:
[,1] [,2]
[1,] 1 5
[2,] 2 6
[3,] 3 7
[4,] 4 8
yields: 1 3 6 10 15 21 28 36
I want:
[,1] [,2]
[1,] 1 5
[2,] 3 11
[3,] 6 18
[4,] 10 26
Is there any command to do so??
best, robert
--
View this message in context:
http://www.nabble.com/cumsum-tf4742648.html#a13562053
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
R-help op r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list