xts(xts)
xts()所属R语言包:xts
Create Or Test For An xts Time-Series Object
为XTS时间序列对象的创建或测试
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Constructor function for creating an extensible time-series object.
构造函数用于创建一个可扩展的时间序列对象。
xts is used to create an xts object from raw data inputs.
xts是用来创建一个xts对象从原始数据输入。
用法----------Usage----------
xts(x = NULL,
order.by = index(x),
frequency = NULL,
unique = TRUE,
tzone = Sys.getenv("TZ"),
...)
is.xts(x)
参数----------Arguments----------
参数:x
an object containing the time series data
一个对象,其中包含的时间序列数据
参数:order.by
a corresponding vector of unique times/dates - must be of a known time-based class. See details.
一个相应的向量的唯一的时间/日期 - 必须是公知的基于时间的类。查看详细信息。
参数:frequency
numeric indicating frequency of order.by. See details.
数字表示频率的order.by。查看详细信息。
参数:unique
should index be checked for unique time-stamps?
独特的时间标记应检查索引吗?
参数:tzone
time zone of series
时区的系列
参数:...
additional attributes to be added. See details.
要添加额外的属性。查看详细信息。
Details
详细信息----------Details----------
An xts object extends the S3 class zoo from the package of the same name.
xts的对象扩展S3类zoo从包中相同名称的。
The first difference in this extension provides for a requirement that the index values not only be unique and ordered, but also must be of a time-based class. Currently acceptable classes include: "Date", "POSIXct", "timeDate", as well as "yearmon" and "yearqtr" where the index values remain unique.
在此扩展提供了第一个不同的索引值的要求不仅是唯一的,有序的,但也必须是一个基于时间的类。目前可以接受的课程包括:“日期”,“POSIXct,TIMEDATE”,以及“yearmon”和“yearqtr的索引值仍然是唯一的。
This last uniqueness requirement has been relaxed as of version 0.5-0. By setting unique=FALSE, only a check that the index is not decreasing is carried out via the isOrdered function.
这最后的唯一性要求已经放宽的版本0.5-0。通过设置独特的= FALSE,只有一张支票,指数减少是通过isOrdered功能。
The second difference is that the object may now carry additional attributes that may be desired in individual time-series handling. This includes the ability to augment the objects data with meta-data otherwise not cleanly attachable to a standard zoo object.
第二个区别是,该对象可能现在携带额外的属性,可能期望在单个时间序列处理。这包括增强的对象数据和元数据,否则不干净地连接到一个标准的动物园对象的能力。
Examples of usage from finance may include the addition of data for keeping track of sources, last-update times, financial instrument descriptions or details, etc.
从财务的使用实例可能包括增加了数据的来源,最后更新的时间,金融工具的描述或细节等跟踪
The idea behind xts is to offer the user the ability to utilize a standard zoo object, while providing an mechanism to customize the object's meta-data, as well as create custom methods to handle the object in a manner required by the user.
xts背后的想法是向用户提供能够利用一个标准的动物园对象,同时提供了一个机制,以自定义对象的元数据,以及创建自定义的方法来处理对象的方式所需要的用户。
Many xts-sepcific methods have been written to better handle the unique aspects of xts. These include, ""["", merge, cbind, rbind, c, Ops, lag, diff, coredata, head and tail. Additionally there are xts specific methods for converting amongst R's different time-series classes.
许多的XTS-sepcific方法已被写入,以便更好地处理方面的独特XTS。这些措施包括,“[”“,合并,CBIND,rbind,C,OPS,滞后性,差异,coredata,头部和尾部。此外,还有XTS具体方法为R的不同时间序列类之间的转换。
Subsetting via "[" methods offers the ability to specify dates by range, if they are enclosed in quotes. The style borrows from python by creating ranges with a double colon “"::"” or “"/"” operator. Each side of the operator may be left blank, which would then default to the beginning and end of the data, respectively. To specify a subset of times, it is only required that the time specified be in standard ISO format, with some form of separation between the elements. The time must be "left-filled", that is to specify a full year one needs only to provide the year, a month would require the full year and the integer of the month requested - e.g. '1999-01'. This format would extend all the way down to seconds - e.g. '1999-01-01 08:35:23'. Leading zeros are not necessary. See the examples for more detail.
“[”方法的子集通过提供指定日期范围的能力,如果他们用引号括起来。的风格借鉴了蟒蛇创建范围双冒号“::”或“/”操作符。每一侧的操作员可以留为空白,将默认的数据的开始和结束,分别。要指定的次数的一个子集,它是只需要指定的时间是在标准的ISO格式,与某种形式的元素之间的分离。时间必须是“左填充”,是指定了整整一年只需要提供一年的,一个月就需要全年的整数月份要求 - 例如, 1999-01。这种格式将一路延伸到秒 - 例如, 1999-01-01 8时35分23秒“。前导零是没有必要的。请参阅更详细的例子。
Users may also extend the xts class to new classes to allow for method overloading.
用户还可以延长xts类新的类的方法重载允许。
Additional benefits derive from the use of as.xts and reclass, which allow for lossless two-way conversion between common R time-series classes and the xts object structure. See those functions for more detail.
额外的好处来自于使用as.xts和reclass,允许进行无损常见的R系列类和xts对象结构之间的双向转换。有关更多详细信息,请参阅这些功能。
值----------Value----------
An S3 object of class xts. As it inherits and extends the zoo class, all zoo methods remain valid. Additional attributes may be assigned and extracted via xtsAttributes.
一个S3对象的类xts。因为它继承并扩展了动物园类,所有动物园的方法仍然有效。额外的属性可以被分配和提取通过xtsAttributes。
注意----------Note----------
Most users will benefit the most by using the as.xts and reclass functions to automagically handle all data abjects as one would handle a zoo object.
大多数用户将受益最多使用as.xts和reclass功能,自动将处理所有数据,下流人会处理zoo对象。
(作者)----------Author(s)----------
Jeffrey A. Ryan and Josh M. Ulrich
参考文献----------References----------
<h3>See Also</h3> <code>as.xts</code>, <code>reclass</code>,
实例----------Examples----------
data(sample_matrix)
sample.xts <- as.xts(sample_matrix, descr='my new xts object')
class(sample.xts)
str(sample.xts)
head(sample.xts) # attribute 'descr' hidden from view[从视图中隐藏属性“的说明]
attr(sample.xts,'descr')
sample.xts['2007'] # all of 2007[2007年]
sample.xts['2007-03/'] # March 2007 to the end of the data set[2007年3月的数据集的结尾]
sample.xts['2007-03/2007'] # March 2007 to the end of 2007[2007年3月到2007年底]
sample.xts['/'] # the whole data set[整个数据集]
sample.xts['/2007'] # the beginning of the data through 2007[2007年开始的数据通过]
sample.xts['2007-01-03'] # just the 3rd of January 2007[只是在2007年1月3日]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|