[R] Cumulative average

Jacques Wagnor jacques.wagnor at gmail.com
Thu May 22 04:10:54 CEST 2008


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 <jholtman at gmail.com> wrote:
> 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.000000 11.000000 10.000000  7.750000  9.600000  9.833333  8.714286
> 10.000000 10.888889 10.300000
> [11] 10.727273 10.916667 10.307692 11.000000 10.866667 11.062500 10.823529
> 10.777778 10.842105 10.500000
>>
>
>
> On Wed, May 21, 2008 at 9:48 PM, Jacques Wagnor <jacques.wagnor at gmail.com>
> 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<http://www.r-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
> --
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
>
> What is the problem you are trying to solve?
>



More information about the R-help mailing list