Last Observation Carried Forward
Generic function for replacing each
NA with the most recent
NA prior to it.
na.locf(object, na.rm = TRUE, ...)
- an object.
- logical. Should leading
NAs be removed?
- further arguments passed to methods.
- An object in which each
NAin the input object is replaced by the most recent non-
NAprior to it. If there are no earlier non-
NAs then the
NAis omitted (if
na.rm = TRUE) or it is not replaced (if
na.rm = FALSE).
az <- zoo(1:6) bz <- zoo(c(2,NA,1,4,5,2)) na.locf(bz) cz <- zoo(c(NA,9,3,2,3,2)) na.locf(cz)
Looks like there are no examples yet.