【发布时间】:2015-03-19 18:46:57
【问题描述】:
在 R 中,如果我有这些数据
date.hour temp
2014-01-05 20:00:00 16
2014-01-06 20:00:00 14
2014-01-06 22:00:00 18
通过seq,我可以获得一系列日期时间
begin <- as.POSIXct('2014-1-5')
end <- as.POSIXct('2014-1-7')
seq(begin, end, by=2*3600)
我如何将数据完成类似于
date.hour temp
2014-01-05 00:00:00 NA
2014-01-05 02:00:00 NA
...
2014-01-05 18:00:00 NA
2014-01-05 20:00:00 16
2014-01-05 22:00:00 NA
...
2014-01-06 20:00:00 18
2014-01-06 22:00:00 14
...
2014-01-07 00:00:00 NA
【问题讨论】:
-
这能回答你的问题吗? Insert rows for missing dates/times
标签: r missing-data