使用哪个 R 时间/日期类和包? [英] Which R time/date class and package to use?
问题描述
我在 R 中的时间序列接触有限.所以,我想知道从哪个时间/日期类(和相关包)开始最合适.
I have a limited time series exposure in R. So, I wonder which time/date class (and associated package) would be most appropriate to start with.
CRAN 任务视图提供的众多软件包中,到目前为止,我赞成 timeDate
,它是面向 S4 的,并且很好地支持与位置相关的特殊性,例如节假日和夏令时.
Among the plethora of packages available at CRAN task view, I so far favor the timeDate
, which is a S4 oriented and has nice support for location dependent particularities such as holidays and daylight saving times.
The community apparently favors the zoo
package. chron
is also popular.
[edit: Here is a list of time/date implementations which lubridate
package refers to: POSIXct, POSIXlt, Date, chron, yearmon, yearqtr, zoo, zooreg, timeDate, xts, its, ti, jul, timeSeries, fts. Also lubridate
itself has handy time classes duration
, period
and interval
.]
如果有使用多个软件包经验的人能就可用时间/日期类在可用性和可扩展性方面的比较发表意见,我将不胜感激.
Would really appreciate if somebody with experience with multiple packages would share his opinion on how the available time/date classes compare in terms of usability and extensibility.
一些兴趣点(按随机顺序):
Some points of interest (in random order):
- 国际化(节假日、时区等)
- 现成的统计建模程序
- 现成的可视化工具
- 易于使用
- 与内置日期/时间序列类 (POSIX,ts) 的兼容性
- 可扩展性(S4 是可取的)
- 最好与
lubridate
一起使用
谢谢.
推荐答案
(应原发帖者的要求,我将把这个从评论移到stackoverflow的答案部分.)
(I am moving this from the comments to the answer portion of stackoverflow at the request of the original poster.)
R News 4/1中有一篇文章(R Help Desk",第 29 页)专门比较 Date
、POSIXct
和 chron
.(前两个是 R 的核心,chron
是一个包.)
There is an article in R News 4/1 ("R Help Desk", p. 29) that specifically compares Date
, POSIXct
and chron
. (The 1st two are in core of R and chron
is a package.)
timeDate
类(在 timeDate
包中)基于 POSIXct
,但具有额外的时区/金融中心支持.
timeDate
class (in the timeDate
package) is based on POSIXct
but has extra time zone/financial center support.
对于规则间隔的系列,tis
包支持许多日期概念.
For regularly spaced series the the tis
package supports many notions of dates.
mondate
包支持会计日期.
zoo
时间序列包几乎支持任何日期/时间类,并且还有 yearmon
和 yearqtr
用于 ts代码> 兼容性.
The zoo
time series package supports just about any date/time class and also has yearmon
and yearqtr
for ts
compatibility.
xts
时间序列包在 zoo
之上工作,并通过将它们转换为 POSIXct
并返回来处理最常见的日期/时间类再次.
The xts
time series package works on top of zoo
and handles the most common date/time classes by translating them to POSIXct
and back again.
时序 CRAN 任务视图中也有信息.
这篇关于使用哪个 R 时间/日期类和包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!