Description Usage Arguments Details Value Author(s) See Also Examples
Used to apply a function to subsets of a data vector. In particular, it is used to find moving averages over a certain "lag" period.
1 | simple.lag(x, lag, FUN = mean)
|
x |
a data vector |
lag |
the lag amount to use. |
FUN |
a function to apply to the lagged data. Defaults to mean |
The function FUN is applied to the data x[(i-lag):i] and assigned to the (i-lag)th component of the return vector. Useful for finding moving averages.
returns a vector.
Provided to R help list by Martyn Plummer
filter
1 2 3 4 5 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.