locf | R Documentation |
Last Observation Carried Forward
locf(object, ...)
object |
vector or data frame |
... |
further arguments |
modified copy, with NAs replaced by last observations carried forward
sales <- c(21, NA, 40, 45) locf(sales) year <- c(1991, 1993, 1995, 1998) mod <- locf(sales ~ year, data = data.frame(year, sales)) predict(mod, tibble::tibble(year = 1994:2000))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.