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
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
Jacques, you should be able to construct a solution from cumsum(). Cheers Andrew On Wed, May 21, 2008 at 08:48:29PM -0500, Jacques Wagnor wrote:> 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.-- Andrew Robinson Department of Mathematics and Statistics Tel: +61-3-8344-6410 University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599 http://www.ms.unimelb.edu.au/~andrewpr http://blogs.mbs.edu/fishing-in-the-bay/
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.