View source: R/moving_average.R
moving_average | R Documentation |
Calculate moving trend coefficients
moving_average(n_year, duration, first_year = 0)
n_year |
Number of available years in the data. |
duration |
Number of years in the moving window. If the number of available years is less than this value, the trend will be calculated for the available years. |
first_year |
First year of the data. Only used to name the rows. |
A matrix with moving average coefficients
One row for each window and and one column for each year in the data.
The format of the row names is average_{window mid point}_{window length}
.
average_2001.5_4
is the average for the years 2000 to 2003.
moving_average(5, 3)
moving_average(5, 3, 2000)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.