[R] Decreasing Cumsum Function?

Charles Annis, P.E. charles.annis at statisticalengineering.com
Tue Mar 23 02:12:27 CET 2010


how about 
sum(X) - cumsum(X)



Charles Annis, P.E.

Charles.Annis at StatisticalEngineering.com
561-352-9699
http://www.StatisticalEngineering.com


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Gundala Viswanath
Sent: Monday, March 22, 2010 9:02 PM
To: r-help at stat.math.ethz.ch
Subject: [R] Decreasing Cumsum Function?

Hi all,

I have a frequency data that looks like this.

3
2
1
5

What I want to get is the "decreasing" cumulative of this data
yielding

11
8
6
5
0

Is there any?

I am aware of cumsum(), which will yield
3
5
6
11.

But it is not what I want.

- G.V.

______________________________________________
R-help at 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