I have a vector (I actually just retrieved individual columns from a dataframe) which has missing data in it. I want to replace the missing data with the next available data
I want to add a next solution which using the runner r cran package.
library(runner)
> fill_run(data, run_for_first = T)
[1] 5 5 5 5 5 5 5 7 7 7
> rev(fill_run(rev(data), run_for_first = T))
[1] 5 5 5 5 5 7 7 7 7 7
The whole package is optimized and major of it was written in cpp. Thus offer a great efficiency.