Hi, What is the best way to accumulate the entries in a vector. For example, a <- c(1,2,3,4,5) And I want to have b <- c(1,3,6,10,15) Best, Karl [[alternative HTML version deleted]]
Hi ?cumsum Regards Petr> > Hi, > > > > What is the best way to accumulate the entries in a vector. For example, > > > > a <- c(1,2,3,4,5) > > > > And I want to have > > > > b <- c(1,3,6,10,15) > > > > > > Best, > > Karl > > > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.
On 11-10-07 6:55 AM, Karl Weinmayer wrote:> Hi, > > > > What is the best way to accumulate the entries in a vector. For example, > > > > a<- c(1,2,3,4,5) > > > > And I want to have > > > > b<- c(1,3,6,10,15)cumsum(a) Duncan Murdoch
R. Michael Weylandt <michael.weylandt@gmail.com>
2011-Oct-07 13:16 UTC
[R] accumulate vector data
cumsum() On Oct 7, 2011, at 6:55 AM, "Karl Weinmayer" <karl.weinmayer at gmx.at> wrote:> Hi, > > > > What is the best way to accumulate the entries in a vector. For example, > > > > a <- c(1,2,3,4,5) > > > > And I want to have > > > > b <- c(1,3,6,10,15) > > > > > > Best, > > Karl > > > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > 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.