R xts 丢失时区属性
R xts loses timezone attribute
我刚刚遇到了我发现 xts 对象的一个非常奇怪的行为。如果我在 xts 对象上使用比较运算符,它会丢失其时区属性。我没有遇到任何其他运营商这样的结果。
> a=matrix(seq(1,4),ncol=2,nrow=2)
> a=xts(a, order.by=as.POSIXct(seq(1,2), origin="1970-01-01", tz="GMT"))
> a
[,1] [,2]
1970-01-01 00:00:01 1 3
1970-01-01 00:00:02 2 4
Warning message:
timezone of object (GMT) is different than current timezone ().
> a>0
[,1] [,2]
1970-01-01 01:00:01 TRUE TRUE
1970-01-01 01:00:02 TRUE TRUE
这是预期的行为还是 xts 实现中的错误?
更新 - xts
包:install.packages("xts", repos="http://R-Forge.R-project.org")
或来自 link
> a>0
[,1] [,2]
1970-01-01 00:00:01 TRUE TRUE
1970-01-01 00:00:02 TRUE TRUE
Warning message:
timezone of object (GMT) is different than current timezone ().
> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
other attached packages:
[1] xts_0.9.874 zoo_1.7-10
loaded via a namespace (and not attached):
[1] grid_3.1.2 lattice_0.20-29 tools_3.1.2
xts has moved to GitHub. This is bug #2750 and was fixed in revision 790 on R-Forge (issue #10 on GitHub 的开发)。 xts 0.9-8 计划在本周末到达 CRAN。
我刚刚遇到了我发现 xts 对象的一个非常奇怪的行为。如果我在 xts 对象上使用比较运算符,它会丢失其时区属性。我没有遇到任何其他运营商这样的结果。
> a=matrix(seq(1,4),ncol=2,nrow=2)
> a=xts(a, order.by=as.POSIXct(seq(1,2), origin="1970-01-01", tz="GMT"))
> a
[,1] [,2]
1970-01-01 00:00:01 1 3
1970-01-01 00:00:02 2 4
Warning message:
timezone of object (GMT) is different than current timezone ().
> a>0
[,1] [,2]
1970-01-01 01:00:01 TRUE TRUE
1970-01-01 01:00:02 TRUE TRUE
这是预期的行为还是 xts 实现中的错误?
更新 - xts
包:install.packages("xts", repos="http://R-Forge.R-project.org")
或来自 link
> a>0
[,1] [,2]
1970-01-01 00:00:01 TRUE TRUE
1970-01-01 00:00:02 TRUE TRUE
Warning message:
timezone of object (GMT) is different than current timezone ().
> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
other attached packages:
[1] xts_0.9.874 zoo_1.7-10
loaded via a namespace (and not attached):
[1] grid_3.1.2 lattice_0.20-29 tools_3.1.2
xts has moved to GitHub. This is bug #2750 and was fixed in revision 790 on R-Forge (issue #10 on GitHub 的开发)。 xts 0.9-8 计划在本周末到达 CRAN。