| locf | R Documentation |
Returns a vector after applied last observation carried forward imputation.
locf(x)
x |
a vector. |
A vector of the same length as x in which each NA has been
replaced by the most recent preceding non-NA value. Leading NAs (those
with no earlier value to carry forward) are left unchanged.
## Not run:
locf(c(NA, 1, 2, 3, NA, 4)) # Returns c(NA, 1, 2, 3, 3, 4)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.