Re: [R] Cumulative average

2008-05-22 Thread Albert Greinoecker
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 > libra

[R] Cumulative average

2008-05-22 Thread 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 ___

Re: [R] Cumulative average

2008-05-21 Thread Andrew Robinson
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

Re: [R] Cumulative average

2008-05-21 Thread Jacques Wagnor
Thank you! Your interpretation was correct. I'll remember to be more specific next time. Thank you for being patient and understanding. Jacques On 5/21/08, jim holtman <[EMAIL PROTECTED]> wrote: > Not sure exactly what you want since you did not provide any data or an > example of the expected

Re: [R] Cumulative average

2008-05-21 Thread jim holtman
Not sure exactly what you want since you did not provide any data or an example of the expected out' Here is my interpretation of what you were asking: > x <- sample(1:20) > x [1] 6 16 8 1 17 11 2 19 18 5 15 13 3 20 9 14 7 10 12 4 > > cumsum(x) / seq_along(x) [1] 6.00 11.00 10

[R] Cumulative average

2008-05-21 Thread 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 ___