几分钟的意外 POSIXct 行为
Unexpected POSIXct behavior for minutes
我不明白为什么 POSIXct returns NA 在某些时候?就在那一天,该功能不起作用是没有意义的。
> as.POSIXct("201003280501", format = "%Y%m%d%H%M", tz = "CET")
[1] "2010-03-28 05:01:00 CEST"
> as.POSIXct("201003280301", format = "%Y%m%d%H%M", tz = "CET")
[1] "2010-03-28 03:01:00 CEST"
> as.POSIXct("201003280201", format = "%Y%m%d%H%M", tz = "CET")
[1] NA
> as.POSIXct("201003290201", format = "%Y%m%d%H%M", tz = "CET")
[1] "2010-03-29 02:01:00 CEST"
润滑工程
> lubridate::as_datetime("201003280201", format = "%Y%m%d%H%M", tz = "CET")
[1] "2010-03-28 02:01:00"
对正在发生的事情有什么建议吗?
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=Danish_Denmark.1252 LC_CTYPE=Danish_Denmark.1252 LC_MONETARY=Danish_Denmark.1252 LC_NUMERIC=C
[5] LC_TIME=Danish_Denmark.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] readr_1.1.1 rjson_0.2.20 odbc_1.1.6 DBI_1.0.0 data.table_1.11.8
loaded via a namespace (and not attached):
[1] Rcpp_1.0.0 crayon_1.3.4 R6_2.3.0 pillar_1.3.0 rlang_0.3.0.1 rstudioapi_0.8 blob_1.1.1 tools_3.5.1 bit64_0.9-7
[10] bit_1.1-14 hms_0.4.2 yaml_2.2.0 compiler_3.5.1 pkgconfig_2.0.2 tibble_1.4.2
原来是从冬令时跳到夏令时的那一天,所以小时不存在。
我不明白为什么 POSIXct returns NA 在某些时候?就在那一天,该功能不起作用是没有意义的。
> as.POSIXct("201003280501", format = "%Y%m%d%H%M", tz = "CET")
[1] "2010-03-28 05:01:00 CEST"
> as.POSIXct("201003280301", format = "%Y%m%d%H%M", tz = "CET")
[1] "2010-03-28 03:01:00 CEST"
> as.POSIXct("201003280201", format = "%Y%m%d%H%M", tz = "CET")
[1] NA
> as.POSIXct("201003290201", format = "%Y%m%d%H%M", tz = "CET")
[1] "2010-03-29 02:01:00 CEST"
润滑工程
> lubridate::as_datetime("201003280201", format = "%Y%m%d%H%M", tz = "CET")
[1] "2010-03-28 02:01:00"
对正在发生的事情有什么建议吗?
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=Danish_Denmark.1252 LC_CTYPE=Danish_Denmark.1252 LC_MONETARY=Danish_Denmark.1252 LC_NUMERIC=C
[5] LC_TIME=Danish_Denmark.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] readr_1.1.1 rjson_0.2.20 odbc_1.1.6 DBI_1.0.0 data.table_1.11.8
loaded via a namespace (and not attached):
[1] Rcpp_1.0.0 crayon_1.3.4 R6_2.3.0 pillar_1.3.0 rlang_0.3.0.1 rstudioapi_0.8 blob_1.1.1 tools_3.5.1 bit64_0.9-7
[10] bit_1.1-14 hms_0.4.2 yaml_2.2.0 compiler_3.5.1 pkgconfig_2.0.2 tibble_1.4.2
原来是从冬令时跳到夏令时的那一天,所以小时不存在。