lubridate 1.7.3 error: CCTZ: Unrecognized timezone of the input vector: ""

lubridate 1.7.3 error: CCTZ: Unrecognized timezone of the input vector: ""

我刚刚安装了最新版本的 lubridate (1.7.3),但出现以下错误

> x <- as.POSIXct("2014-06-01 08:21:59 BST")
> for (j in 1:1e4){
     dum <- lubridate::force_tz(x, tzone = 'UTC')
 }
> for (j in 1:1e8){
     dum <- lubridate::force_tz(x, tzone = 'UTC')
 }
Error in C_force_tz(time, tz = tzone, roll) : 
  CCTZ: Unrecognized timezone of the input vector: ""
> j
[1] 580

奇怪的是,如果我在第一个循环后继续使用 1e4 我不明白,如果我从 1e8 开始我不明白。有什么想法吗?

我试过按照你说的那样做,循环甚至不会遍历所有 1e8 的值而不会使我的机器崩溃(这非常强大,所以这是一个惊喜) .另外,我注意到原来制作的dum只有一个日期,其余都是NA.

这会做你需要的同样的事情吗?我猜你需要用 Date 个对象初始化一个向量。它对我来说非常有效:

> dum <- rep(lubridate::force_tz(x, tzone = 'UTC'),100000000)
> str(dum)
   POSIXct[1:100000000], format: "2014-06-01 08:21:59" "2014-06-01 08:21:59" "2014-06-01 08:21:59" "2014-06-01 08:21:59" ...
> system.time(rep(lubridate::force_tz(x, tzone = 'UTC'),100000000))
   user  system elapsed 
   0.31    0.24    0.55 

这已在 github 版本的 lubridate https://github.com/tidyverse/lubridate/commit/c4636354e72ce1e6c427784cca94292b58a9271b 中解决。

他们希望在本周发布修复程序