我可以使用日期对象而不是整数来制作时间序列吗?

时间:2014-10-23 15:19:24

标签: r date time-series

我正在尝试在R中分析时间序列数据。它是从excel以CSV格式提供的,我随后将其作为data.frame all读取。我们假设它有两列:all$dateall$people,代表特定日期的人数。因此频率是每天。

来自Excel,日期是整数,表示自1900-01-01以来的天数。 我可以将数据读作people = ts(all$people, start=c(all$date[1], 1), frequency=365);,但由于数据从2006年开始,因此它的启动值几乎为40000.根据start?ts参数不会占用日期对象,所以我不能只使用as.Date()

ts - ...
start: the time of the first observation. Either a single number 
or a vector of two integers, which specify a natural time unit and
a (1-based) number of samples into the time unit. See the examples 
for the use of the second form.

我当然可以设置start=1,但是当情节告诉我在2100年左右发生有趣的事情时,弄清楚我们在哪个季节会有点痛苦。(要清楚,设置{{1}确实告诉我我们在哪一年,但没有更精确的日期)。是否有一种有用的方式以人类可读的形式在frequency=365中表达日期,这样我就不必继续致电ts来了解有趣的特征何时发生?

0 个答案:

没有答案
相关问题