Description Usage Arguments Details Value Examples
Find the "previous" (lagx()
) or "next" (leadx()
) values in a vector.
Useful for comparing values behind of or ahead of the current values.
1 2 3 |
x |
Univariate vector, numeric or ts object with only one dimension. |
n |
Value indicating the number of positions to lead or lag by. |
fill |
Numeric value(s) or function used to fill observations. |
This functions has been taken and modified from the dplyr
package,
however, to reduce dependencies they are not imported.
Returns a vector with the same class and attributes as the input vector.
1 2 3 4 5 6 7 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.