fill_run {runner} | R Documentation |
Fill NA with previous non-NA element
Description
Fill NA
with last non-NA element.
Usage
fill_run(x, run_for_first = FALSE, only_within = FALSE)
Arguments
x |
( |
run_for_first |
If first elements are filled with |
only_within |
|
Value
vector - x
containing all x
elements with NA
replaced with previous non-NA element.
Examples
fill_run(c(NA, NA, 1:10, NA, NA), run_for_first = TRUE)
fill_run(c(NA, NA, 1:10, NA, NA), run_for_first = TRUE)
fill_run(c(NA, NA, 1:10, NA, NA), run_for_first = FALSE)
fill_run(c(NA, NA, 1, 2, NA, NA, 2, 2, NA, NA, 1, NA, NA), run_for_first = TRUE, only_within = TRUE)
[Package runner version 0.4.4 Index]