R 动物园里的不同日期格式

R 动物园里的不同日期格式,r,ggplot2,zoo,R,Ggplot2,Zoo,我发现运行R2.12.1的两个环境在行为上存在差异。在第一场比赛中,一家动物园的表现与预期相符 > library(zoo) > x.date <- as.Date(paste(2003, 2, c(1, 3, 7, 9, 14), sep = "-")) > x <- zoo(rnorm(5), x.date) > index(x) [1] "2003-02-01" "2003-02-03" "2003-02-07" "2003-02

我发现运行R2.12.1的两个环境在行为上存在差异。在第一场比赛中,一家动物园的表现与预期相符

> library(zoo)
> x.date <- as.Date(paste(2003, 2, c(1, 3, 7, 9, 14), sep = "-"))
    > x <- zoo(rnorm(5), x.date)
    > index(x)
    [1] "2003-02-01" "2003-02-03" "2003-02-07" "2003-02-09" "2003-02-14"
    > as.Date(index(x))
    [1] "2003-02-01" "2003-02-03" "2003-02-07" "2003-02-09" "2003-02-14"
> sessionInfo()
R version 2.12.1 (2010-12-16)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
[1] C

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] ggplot2_0.8.9 proto_0.3-9.1 reshape_0.8.4 MASS_7.3-9    plyr_1.4      RODBC_1.3-2   zoo_1.6-4

loaded via a namespace (and not attached):
[1] lattice_0.19-13 tools_2.12.1
>图书馆(动物园)
>x.日期x索引(x)
[1] "2003-02-01" "2003-02-03" "2003-02-07" "2003-02-09" "2003-02-14"
>截至日期(索引(x))
[1] "2003-02-01" "2003-02-03" "2003-02-07" "2003-02-09" "2003-02-14"
>sessionInfo()
R版本2.12.1(2010-12-16)
平台:x86_64-unknown-linux-gnu(64位)
区域设置:
[1] C
附加基本包:
[1] grid stats图形设备grutils数据集方法库
其他随附包裹:
[1] ggplot2\u 0.8.9原型\u 0.3-9.1重塑\u 0.8.4质量\u 7.3-9 plyr\u 1.4 RODBC\u 1.3-2动物园\u 1.6-4
通过命名空间加载(未附加):
[1] lattice_0.19-13工具_2.12.1
在另一个示例中,我得到以下输出:

> library(zoo)
> x.date <- as.Date(paste(2003, 2, c(1, 3, 7, 9, 14), sep = "-"))
> x <- zoo(rnorm(5), x.date)
> index(x)
[1] "02/01/2003 00:00:00.000 UTC" "02/03/2003 00:00:00.000 UTC" "02/07/2003 00:00:00.000 UTC" "02/09/2003 00:00:00.000 UTC" "02/14/2003 00:00:00.000 UTC"
> as.Date(index(x))
[1] "02/01/2003 00:00:00.000 UTC" "02/03/2003 00:00:00.000 UTC" "02/07/2003 00:00:00.000 UTC" "02/09/2003 00:00:00.000 UTC" "02/14/2003 00:00:00.000 UTC"
> sessionInfo()
R version 2.12.1 (2010-12-16)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
[1] C

attached base packages:
[1] grid      grDevices graphics  stats     datasets  utils     methods   base

other attached packages:
[1] zoo_1.6-4     ggplot2_0.8.9 proto_0.3-8   reshape_0.8.4 plyr_1.4

loaded via a namespace (and not attached):
[1] digest_0.4.2    lattice_0.19-13
>图书馆(动物园)
>x.日期x索引(x)
[1] “02/01/2003 00:00:00.000 UTC”“02/03/2003 00:00:00.000 UTC”“02/07/2003 00:00:00.000 UTC”“02/09/2003 00:00:00.000 UTC”“02/14/2003 00:00:00:00.000 UTC”
>截至日期(索引(x))
[1] “02/01/2003 00:00:00.000 UTC”“02/03/2003 00:00:00.000 UTC”“02/07/2003 00:00:00.000 UTC”“02/09/2003 00:00:00.000 UTC”“02/14/2003 00:00:00:00.000 UTC”
>sessionInfo()
R版本2.12.1(2010-12-16)
平台:x86_64-unknown-linux-gnu(64位)
区域设置:
[1] C
附加基本包:
[1] 网格grDevices图形统计数据集utils方法库
其他随附包裹:
[1] zoo_1.6-4 ggplot2_0.8.9原型_0.3-8重塑_0.8.4 plyr_1.4
通过命名空间加载(未附加):
[1] 摘要第0.4.2节第0.19-13节

这不仅奇怪,而且后一种行为会导致来自ggplot2的错误消息。有什么见解吗?提前感谢。

@gappy这些环境是什么?第二个环境看起来很糟糕。日期不应以这种方式打印。但是我想不出任何东西会让从日期到POSIXt的隐式转换(这就是打印格式的用途)。@chl Linux Red Hat Enterprise。每个环境的
sessionInfo()
是什么?zoo不知道日期。这和动物园没关系。@gappy这些环境是什么?第二个环境看起来很像马车。日期不应以这种方式打印。但是我想不出任何东西会让从日期到POSIXt的隐式转换(这就是打印格式的用途)。@chl Linux Red Hat Enterprise。每个环境的
sessionInfo()
是什么?zoo不知道日期。这与动物园无关。