you might want to look at the rollmean function in the zoo package if you want a fixed window. If you want a cumulative mean then you can do something like
> cumsum(x)/seq_along(x) If neither of those work, then give us some more detail. ________________________________________ From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of Ayesha [ayesha.diamond...@gmail.com] Sent: Thursday, January 28, 2010 8:38 PM To: r-help@r-project.org Subject: Re: [R] random permuted block randomization oki :D and do you know if there is an inbuilt R pacakage that calculate moving averages over time? i found this , "Calculate various moving averages (MA) of a series." Usage SMA(x, n=10) EMA(x, n=10, wilder=FALSE) but when i tried SMA , R wouldnt recognize it! and there isnt such a package as SMA in the install packages list either. -- View this message in context: http://n4.nabble.com/random-permuted-block-randomization-tp1401407p1401504.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@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. ______________________________________________ R-help@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.