R中的zoo对象和ts对象有什么区别? [英] What is the difference the zoo object and ts object in R?

查看:50
本文介绍了R中的zoo对象和ts对象有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道使用 ts()zoo() 函数的区别.

I want to know the differences into use ts() or zoo() function.

推荐答案

zoo 对象的索引属性中的时间值(可能是不规则的)由 print.zooprint.zoo 在控制台显示为行名称code> 方法以及矩阵或原子向量中的值,这些值对可以使用的值施加了限制(通常是数字,但必须全部是单一模式,即不是像数据帧那样具有多种模式的列表).加载 pkg:zoo 后,获取具有动物园方法的函数列表:

A zoo object has the time values (possibly irregular) in an index attribute displayed like a row name at the console by the print.zoo method and the values in a matrix or atomic vector which places constraints on the values that can be used (generally numeric, but necessarily all of a single mode, i.e. not as a list with multiple modes like a dataframe might hold). With pkg:zoo loaded, to get a list of functions that have zoo-methods:

library(zoo)
methods(class="zoo")

yrmon- 类被添加到允许每月日期索引.你可以看到方法的范围:

The yrmon- class is added to allow monthly date indices. you can see the range of methods:

methods(class="yearmon")

xts 类是动物园方法的重要扩展,但需要一个额外的包.SO 上有很多 Zoo 和 xts 函数的工作示例.

The xts-class is an important extension to the zoo methods but an additional package is needed. There are many worked examples of zoo and xts functions on SO.

ts 对象具有单一模式的值,其属性总是暗示定期观察,并且这些属性支持循环周期,例如年和月.不是逐项或逐行存储索引,而是使用存储为属性的开始"、结束"和频率"值动态计算索引,并可通过这些名称使用函数访问.ts-objects 的函数列表明显很小(大多数人发现它们更难使用):

A ts-object has values of a single mode with attributes that always imply regular observations and those attributes support a recurring cycle such as years and months. Rather than storing the index item by item or row by row, the index is calculated on the fly using 'start', 'end' and 'frequency' values stored as attributes and accessible with functions by those names. The list of functions for ts-objects is distinctly small (and most people find them more difficult to work with):

methods(class="ts")

还有一个用于不规则时间序列的 its-package,但它明显不如 zoo-package 受欢迎,并且显然已被放弃.

There was also an its-package for irregular time series, but it was distinctly less popular than the zoo-package and has apparently been abandoned.

这篇关于R中的zoo对象和ts对象有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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