fill_locf {transx} | R Documentation |
Fill with "Last Observation Carried Forward"
Description
Fill with "Last Observation Carried Forward"
Usage
fill_locf(body, idx, fail = NA)
Arguments
body |
The body of the vector. |
idx |
the index to replace with. |
fail |
In case it fails to fill some values. |
Value
Returns a vector with the same class and attributes as the input vector.
Examples
x <- c(5,3,2,2,5)
lagx(x, n = 2, fill = fill_locf)
leadx(x, n = 2, fill = fill_locf)
lagx(x, n = 2, fill = fill_nocb)
leadx(x, n = 2, fill = fill_nocb)
[Package transx version 0.0.1 Index]