Dear M.Rahiz,

Unfortunatelly I can't reproduce your example.
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>

bests

milton
On Sat, Jan 2, 2010 at 9:26 AM, Muhammad Rahiz <muhammad.ra...@ouce.ox.ac.uk
> wrote:

> Hello useRs,
>
> I'd like to perform a moving average on the dataset, xx. I've tried
> combining the functions Reduce and rollmean but it didn't work.
>
> > r <- function(n) rollmean(n, 2) # where 2 = averaging interval
> > output < - Reduce("r", x)
> Error in f(init, x[[i]]) : unused argument(s) (x[[i]])
>
> Is there anything wrong with the code in the first place?
>
> where
> > x
>
> [[1]]
>    V1 V2 V3
> [1,]  1  1  1
> [2,]  2  2  2
> [3,]  3  3  3
>
> [[2]]
>    V1 V2 V3
> [1,]  4  4  4
> [2,]  5  5  5
> [3,]  6  6  6
>
> [[3]]
>    V1 V2 V3
> [1,]  7  7  7
> [2,]  8  8  8
> [3,]  9  9  9
>
> The moving average is to be performed on
>
> 1,4,7 = (1+4)/2 , (4+7)/2
> 2,5,8 = ..
> 3,6,9 = ..
>
> Thanks
>
> Muhammad
>
> --
> Muhammad Rahiz  |  Doctoral Student in Regional Climate Modeling
> Climate Research Laboratory, School of Geography & the Environment
> Oxford University Centre for the Environment, University of Oxford
> South Parks Road, Oxford, OX1 3QY, United Kingdom
> Tel: +44 (0)1865-285194  Mobile: +44 (0)7854-625974
> Email: muhammad.ra...@ouce.ox.ac.uk
>
> ______________________________________________
> 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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to