irregular time series data- can I make it regular? in r

放肆的年华 提交于 2019-12-06 06:07:41

library(zoo) can deal with irregular time series, and, as Gabor said, the Zoo FAQ has methods for aggregating multiple observations per day:

z <- zoo( x=data.frame(....), order.by=loc$DateTime ) # translate 'loc' into zoo somehow 

za <- aggregate(z, identity, mean)  # take the mean of identically timed objects 

...and fill in missing data with locally fit data:

g  <- seq(start(z),end(z),by=1/frequency(z)) 
zi <- na.locf(z,xout=g)
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!