Description Usage Arguments Examples
View source: R/data_wrangling.R
Will repeat the last non-NA value. This is also known as carrying the last observation forward/backward. It's faster than zoo::na.locf http://rpubs.com/rubenarslan/repeat_last_na_locf and other alternatives. By specifying maxgap, you can choose not to bridge overly long gaps. By specifying forward = FALSE, you can carry the last observation backward.
1 | repeat_last(x, forward = TRUE, maxgap = Inf, na.rm = FALSE)
|
x |
vector to be repeated |
forward |
carry last observation forward? or backward (FALSE) |
maxgap |
bridge only up to x NAs (defaults to Inf) |
na.rm |
whether to omit NAs at the beginning (defaults to FALSE) |
1 2 3 4 5 6 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.