Description Usage Arguments Value Examples
View source: R/fill-functions.R
1 |
body |
The body of the vector. |
idx |
the index to replace with. |
fail |
In case it fails to fill some values. |
Returns a vector with the same class and attributes as the input vector.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | x <- c(5,3,2,2,5)
lagx(x, n = 2, fill = fill_locf)
# A not so very neat way to deal with NA when `fill_locf` fails is (WIP)
lagx(x, n = 2, fill = ~ fill_locf(.x,.y, fail = 0))
leadx(x, n = 2, fill = fill_locf)
lagx(x, n = 2, fill = fill_nocb)
leadx(x, n = 2, fill = fill_nocb)
leadx(x, n = 2, fill = ~ fill_nocb(.x,.y, fail = 0))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.