naReplace {ahw} | R Documentation |
vec
with last non-NA valueAssumes first element is non-NA
naReplace(vec)
vec |
Vector of any type |
numeric
vector
with each NA
entry replaced with the last previous non-NA
entry.
Can be replaced by link[zoo]{na.locf0}
Pål Christie Ryalen <p.c.ryalen@medisin.uio.no>
naReplace(c(1, 2, 3, NA, NA, 4))
naReplace(c("text", NA, NA))