[R] Cumulative average

Albert Greinoecker albert.greinoecker at uibk.ac.at
Thu May 22 10:41:23 CEST 2008


does e.g.
x <- c(8,5,4,2)
cumsum(x) / 1:length(x)
do what you need?
Albert

Am Mittwoch, den 21.05.2008, 20:36 -0500 schrieb Jacques Wagnor:
> Dear List,
> 
> Does there exist a function that calculates a cumulative average?
> Neither running() from library(gregmisc) nor running.mean() from
> library(igraph) seems to be able to give a cumulative average.
> 
> Any help or pointers would be greatly appreciated.
> 
> Jacques
> 
> ______________________________________________
> 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