roll_na_fill {timeplyr} | R Documentation |
Fast grouped "locf" NA
fill
Description
A fast and efficient by-group method for
"last-observation-carried-forward" NA
filling.
Usage
roll_na_fill(x, g = NULL, fill_limit = Inf)
Arguments
x |
A vector. |
g |
An object use for grouping x This may be a vector or data frame for example. |
fill_limit |
(Optional) maximum number of consecutive NAs to fill
per |
Details
Method
When supplying groups using g
, this method uses radixorder(g)
to
specify how to loop through x
, making this extremely efficient.
When x
contains zero or all NA
values, then x
is returned with no copy
made.
Value
A filled vector of x
the same length as x
.
[Package timeplyr version 1.1.0 Index]