I have a zoo time series with missing days. In order to fill it and have a continuous series I do...
I generate a chron date-time sequence from start to end.
I merge my series with this one.
I use na.locf to substitute NAs with las obsservation.
I remove the syntetic chron sequence.
Can I do same easier? Maybe with some index function related to the frequency?
It's slightly easier if you use a "empty"
zoo
object with an index.EDIT: For intra-day data (using Gabor's excellent
xout=
suggestion):This is covered in question 13 of the zoo FAQ http://cran.r-project.org/web/packages/zoo/vignettes/zoo-faq.pdf which uses the xout= argument of na.locf to eliminate the merge step. Be sure you are using zoo 1.6.4 or later since this feature was added recently.