Description Usage Arguments Value Author(s) Examples
Generic function for computing a moving (sliding) average of ts.
1 2 3 4 5 6 7 |
x |
ts or zoo object. |
win.len |
number of terms that will be considered in the mean. It have to be odd |
FUN |
Function that have to be applied for computing the moving average. Usually, |
... |
further arguments passed to or from other methods. |
a vector with the moving average termns. The length of the resulting vector is the same of x
, but the first and last (win.len-1)/2
elements will be NA.
Mauricio Zambrano-Bigiarini, mzb.devel@gmail
1 2 3 4 5 6 7 8 9 10 11 12 | ## Loading daily streamflows at the station Oca en Ona (Ebro River basin, Spain) ##
data(OcaEnOnaQts)
x <- OcaEnOnaQts
## Daily to Monthly ts
m <- daily2monthly(x, FUN=mean, na.rm=FALSE)
# Plotting the monthly values
plot(m, xlab="Time")
## Plotting the annual moving average in station 'x'
lines(ma(m, win.len=12), col="blue")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.