Description Usage Arguments Note See Also Examples
Return a time series with suitably lagged differences of the observation values. Observation times without corresponding lagged observation time (for example, the second observation for lag=3
) are dropped from the output.
1 2 |
x |
a |
lag |
an integer indicating which lag to use. |
scale |
on which scale to calculate differences. Either |
... |
further arguments passed to or from methods. |
For an evenly spaced time series, calculating differences over (1) a certain number of observations (e.g. over four observations for quarterly data), and (2) over a fixed time horizon (e.g. over one year) gives the same result. For unevenly spaced time series, however, these two operations are quite different.
diff_t
allows to calculate differences over a fixed time horizon, as opposed to number of observations.
diff
in base R.
1 2 3 4 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.