在Mac上的R时区警告 [英] r timezone warning on mac
问题描述
当我使用POSIX命令运行脚本时,我收到了令人讨厌的时区警告,我决定进行调查.在启动时运行以下命令
I've been getting annoying time zone warnings when I run a script with POSIX commands to I decided to investigate. When I run the following commands on startup
Sys.time()
Sys.Date()
Sys.timezone()
我知道
> date()
[1] "Mon Nov 27 09:10:32 2017"
> Sys.time()
[1] "2017-11-27 16:10:51 GMT"
> Sys.Date()
[1] "2017-11-27"
> Sys.timezone()
[1] NA
>
当我查看日期&在我的mac设置中的时区"选项卡上,我看到时区已正确设置为山区标准时间".最后,当我第一次运行一些查找时区信息的代码时,我收到以下警告消息
When I look under the Date & Time Zone tab in my mac settings, I see that the time zone is set correctly to Mountain Standard Time. Finally, when I first run some code that looks for time zone information I get the following warning message
Warning messages:
1: In as.POSIXlt.POSIXct(x, tz) :
unknown timezone 'zone/tz/2017c.1.0/zoneinfo/America/Denver'
据我所知,我的Mac上没有类似"zone/tz/..."的路径,所以问题是如何使POSIX在正确的位置查找时区信息
As far as I can tell I don't have a path on my mac that looks like "zone/tz/..." so the question is how to get POSIX looking in the correct place(s) for timezone information.
推荐答案
根据2017年11月30日发布的R 3.4.3中的新功能列表,
According to the new features list in R 3.4.3, released Nov 30 2017,
已添加解决方法,以更改 macOS 10.13"High Sierra"中的时区文件,然后在 10.13.1,因此默认时区是从 使用--with-internal-tzcode配置R时的系统设置 (macOS上的默认设置).
A workaround has been added for the changes in location of time-zone files in macOS 10.13 'High Sierra' and again in 10.13.1, so the default time zone is deduced correctly from the system setting when R is configured with --with-internal-tzcode (the default on macOS).
使用Microsoft版本的R的用户可以在2018年1月10日获得MRO 3.4.3.
MRO 3.4.3 will be available on 2018-01-10 for those using Microsoft's version of R.
这篇关于在Mac上的R时区警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!