linear interpolate missing values in time series

前端 未结 4 979
悲哀的现实
悲哀的现实 2020-12-09 21:01

I would like to add all missing dates between min and max date in a data.frame and linear interpolate all missing values, like

df <- data.fra         


        
4条回答
  •  时光取名叫无心
    2020-12-09 21:03

    Another nice and short solution (using imputeTS):

    library(imputeTS)
    x <- zoo(df$value,df$date)
    x <- na.interpolation(x, option = "linear")
    print(x)
    

提交回复
热议问题