为什么R不认可“CST”为有效的时区? [英] Why doesn't R recognize 'CST' as a valid timezone?

查看:851
本文介绍了为什么R不认可“CST”为有效的时区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此代码适用于:

ISOdatetime(2011,4,7,12,0,0, tz = "EST")

此代码不会:

ISOdatetime(2011,4,7,12,0,0, tz = "CST")

我想要中央时区,没有调整夏令时。我究竟做错了什么?在哪里可以找到由R认可的时区表?

I want the central time zone, with no adjustment for daylight savings. What am I doing wrong? Where can I find a table of timezones recognized by R?

编辑:感谢信息Josh,但 ISOdatetime(2011,3,13, 2,0,0,tz =America / Chicago)产生NA,不幸的是我的数据集中的值。任何想法如何处理?看来我的数据集是在芝加哥的时间,但没有观察到夏令时。

edit: Thanks for the info Josh, but ISOdatetime(2011,3,13,2,0,0, tz = "America/Chicago") yields NA, and is unfortunately a value in my dataset. Any ideas how to deal with this? It seems like my dataset is on Chicago time, but does not observe daylight savings time.

推荐答案

请参阅 ?时区和文件 R_HOME / share / zoneinfo / zone.tab

没有中央时区,没有调整夏令时的事情。美国中部时区有DST规则,多年来已经发生了变化。您可以随时以GMT格式读取您的日期,添加6小时,然后转换为CST6CDT。

There's no such thing as "the central time zone, with no adjustment for daylight savings". The US central time zone has DST rules and they have changed over the years. You could always read in your dates as GMT, add 6 hours, then convert to CST6CDT.

> .POSIXct(ISOdatetime(2011,3,13,2,0,0, tz="GMT")+3600*6, tz="CST6CDT")
[1] "2011-03-13 03:00:00 CDT"
> .POSIXct(ISOdatetime(2011,3,13,2,0,0, tz="GMT")+3600*6, tz="America/Chicago")
[1] "2011-03-13 03:00:00 CDT"

这篇关于为什么R不认可“CST”为有效的时区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆