Generic function for replacing each NA with the most recent
non-NA prior to it.
Usage
na.locf(object, na.rm = TRUE, ...)
Arguments
object
an object.
na.rm
logical. Should leading NAs be removed?
...
further arguments passed to methods.
Value
An object in which each NA in the input object is replaced
by the most recent non-NA prior to it. If there are no earlier non-NAs then
the NA is omitted (if na.rm = TRUE) or it is not replaced (if na.rm = FALSE).