Skip to content
Prev 280876 / 398503 Next

linear interpolation of time series

zoo:::na.approx will do nicely. Though you are going to have to supply
some sort of time metric or it won't know where interpolations should
happen.

Something like this is my usual route:

x <- zoo(1:5, Sys.Date() + 2*(1:5))

x.new <- zoo(NA, seq(min(time(x)), to =  max(time(x)), by = "day"))

x.new[time(x)] <- x

na.approx(x.new)

Michael
On Sat, Dec 24, 2011 at 5:39 PM, Alemtsehai Abate <abatealem at gmail.com> wrote: