Description Usage Arguments Value Author(s)
Calculate the distance between each element in a numeric vector and
the element that is lag
positions after it. For the last
lag
elemnts, this distance does not exist, so NA is used as a placeholder.
The returned vector is of the same length as the input vector.
1 | lagDistance(vec, lag = 1, reverse = FALSE)
|
vec |
numeric. |
lag |
integer. |
reverse |
logical. Default to FALSE, i.e. calculate |
numeric.
Kaiyin Zhong, Fan Liu
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.