谁能告诉我为什么我只有1895个元素而不是1896个元素(79天X 24小时)?
time_index< - seq(from = as.POSIXct(“2017-01-02 01:00”),to = as.POSIXct(“2017-03-21 24:00”),by =“hour” )
长度(时间指数) [1] 1895年
答案 0 :(得分:4)
time_index[1655:1660]
[1] "2017-03-11 23:00:00 EST" "2017-03-12 00:00:00 EST"
[3] "2017-03-12 01:00:00 EST" "2017-03-12 03:00:00 EDT"
[5] "2017-03-12 04:00:00 EDT" "2017-03-12 05:00:00 EDT"
要阻止它发生,必须选择没有夏令时的时区,这是一个例子
time_index <- seq(from = as.POSIXct("2017-01-02 01:00",tz = 'UTC'),
to = as.POSIXct("2017-03-21 24:00", tz = 'UTC'),
by = "hour")
length(time_index)
[1] 1896