View source: R/moving_difference.R
moving_difference | R Documentation |
Calculate coefficients for a moving difference
moving_difference(n_year, duration, first_year = 1)
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
difference_{window mid point start}_{window mid point end}_{window length}
.
difference_2001.5_2010.5_4
is the difference of the average for period for
the years 2009 to 2012 compared to the period from 2000 to 2003.
moving_difference(6, 2)
moving_difference(6, 2, 2000)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.