Interpolate zoo object with missing Dates

前端 未结 1 1629
借酒劲吻你
借酒劲吻你 2020-12-05 19:56

I have a climate time series with missing Dates (not missing values). For example:

n = 15
full.dates = seq(Sys.Date(), by = \'day\', length = n)
serie.dates          


        
相关标签:
1条回答
  • 2020-12-05 20:42

    Merge with an "empty" object that has all the dates you want, then use na.approx (or na.spline, etc.) to fill in the missing values.

    x <- merge(serie, zoo(,seq(start(serie),end(serie),by="day")), all=TRUE)
    x <- na.approx(x)
    
    0 讨论(0)
提交回复
热议问题