xts 子集 - 夏令时

xts subset - daylight savings time

我正在尝试为 1 分钟频率数据集的特定分钟编制索引。 (我一直使用 'T../T..' 因为 .indexmin 有(/有?)一些

以下两个 xts 对象具有相同的长度 (nrow),没有重复,下面的子集应该 return 为零(凌晨 2 点没有 obs)。一个有效,另一个无效(returns all obs)。我认为这与 DST 转换有关(尽管两者都以 EDT 作为索引)。 Sys.timezone() 也设置为 EST5EDT。任何想法如何解决这一问题?

xcheck1 <- readRDS(gzcon(url("https://dl.dropboxusercontent.com/s/8yg9q854umipjna/xts_problem_1.rds"))) 
xcheck2 <- readRDS(gzcon(url("https://dl.dropboxusercontent.com/s/qm83b0ayz03appg/xts_problem_2.rds")))
xcheck1['T02:00/T02:00:10']
xcheck2['T02:00/T02:00:10']

它是 a bug 并且已在最新的 CRAN 版本 (0.10-0) 中修复。现在 returns 你所期望的(无),在这两种情况下。

library(xts)
Sys.setenv(TZ = "EST5EDT")
urls <- paste0("https://dl.dropboxusercontent.com/s/",
               c("8yg9q854umipjna", "qm83b0ayz03appg"),
               "/xts_problem_", 1:2, ".rds")
xcheck1 <- readRDS(gzcon(url(urls[1])))
xcheck2 <- readRDS(gzcon(url(urls[2])))
xcheck1['T02:00/T02:00:10']
#      AUDUSD.ask.Close
xcheck2['T02:00/T02:00:10']
#      AUDUSD.ask.Close
packageVersion("xts")
# [1] '0.10.0'