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
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
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
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
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
___
6 matches
Mail list logo