R lubridate:为什么我会收到 "unknown timezone" 错误?

R lubridate: Why do I get a "unknown timezone" error?

为什么我在尝试使用 mdy 函数时出现 "unknown timezone" 错误?

> library(lubridate)

Attaching package: ‘lubridate’

The following object is masked from ‘package:base’:

    date

> mdy('15-01-2018')
Error in as.POSIXlt.POSIXct(x, tz) : 
  (converted from warning) unknown timezone 'zone/tz/2017c.1.0/zoneinfo/Asia/Hong_Kong'

根据 Matt Gibson and Roland 的建议, 该错误与 运行 旧版本的 R.

有关

我在2017年8月左右安装了R版本3.4.1, 当我的电脑是 运行 macOS 10.12 Sierra 时。 2017 年 11 月左右,我将 macOS 更新到 10.13 High Sierra。 在我安装 R 3.4.3 版本后, unknown timezone 错误不再出现。

> library(lubridate)

Attaching package: ‘lubridate’

The following object is masked from ‘package:base’:

    date

> mdy('15-01-2018')
[1] NA
Warning message:
All formats failed to parse. No formats found. 

当然是格式解析失败, 因为 Prem InfiniteFlashChess 提到, 我在 mdy 函数中混淆了月份和日期。

> mdy('01-15-2018')
[1] "2018-01-15"