If you are referring to rollmean in the zoo package then na.pad = TRUE
will cause the output to be the same length as the input:
> library(zoo)
> rollmean(zoo(1:10), 3, na.pad = TRUE)
1 2 3 4 5 6 7 8 9 10
NA 2 3 4 5 6 7 8 9 NA> rollmean(zoo(matrix(1:10, 5)), 3, na.pad = TRUE)
1 NA NA
2 2 7
3 3 8
4 4 9
5 NA NA
On Nov 23, 2007 4:02 PM, Jonas Stein <news at jonasstein.de>
wrote:> Hi,
>
> i have some data, that has 1-5 % noise.
> I want to smooth this data without loosing rows.
>
> rollmean() would be great, but it returns a vector of different size as the
> initial vector.
>
> --
> kind regards,
>
> Jonas Stein <news at jonasstein.de>
>
> ______________________________________________
> 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
> and provide commented, minimal, self-contained, reproducible code.
>