window.zoo(zoo)
window.zoo()所属R语言包:zoo
Extract/Replacing the Time Windows of Objects
提取/替换对象的时间窗
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Methods for extracting time windows of "zoo" objects and replacing it.
方法提取时间窗"zoo"对象和更换。
用法----------Usage----------
## S3 method for class 'zoo'
window(x, index. = index(x), start = NULL, end = NULL, ...)
## S3 replacement method for class 'zoo'
window(x, index. = index(x), start = NULL, end = NULL, ...) <- value
参数----------Arguments----------
参数:x
an object.
一个对象。
参数:index.
the index/time window which should be extracted.
索引/时间窗口,应提取的。
参数:start
an index/time value. Only the indexes in index which are greater or equal to start are used. If the index class supports comparisons to character variables, as does "Date" class, "yearmon" class, "yearqtr" class and the chron package classes "dates" and "times" then start may alternately be a character variable.
索引/时间值。只有在index的索引大于或等于start使用。如果索引类支持比较字符变量,并"Date"类"yearmon"类"yearqtr"类chron包中的类"dates"和<X >"times"可交替是一个字符变量。
参数:end
an index/time value. Only the indexes in index which are lower or equal to end are used. Similar comments about character variables mentioned under start apply here too.
索引/时间值。只有在index的索引是低于或等于end使用。类似的评论关于字符变量提到的start的这里也适用。
参数:value
a suitable value object for use with window(x).
一个合适的值对象使用window(x)。
参数:...
currently not used.
目前未使用。
值----------Value----------
Either the time window of the object is extracted (and hence return a "zoo" object) or it is replaced.
要么被提取的对象的时间窗口(并因此返回一个"zoo"对象),或者它被替换。
参见----------See Also----------
zoo
zoo
实例----------Examples----------
## zoo example[#动物园的例子]
x.date <- as.Date(paste(2003, rep(1:4, 4:1), seq(1,19,2), sep = "-"))
x <- zoo(matrix(rnorm(20), ncol = 2), x.date)
x
window(x, start = as.Date("2003-02-01"), end = as.Date("2003-03-01"))
window(x, index = x.date[1:6], start = as.Date("2003-02-01"))
window(x, index = x.date[c(4, 8, 10)])
window(x, index = x.date[c(4, 8, 10)]) <- matrix(1:6, ncol = 2)
x
## for classes that support comparisons with "character" variables[#类支持比较“性格”变量]
## start and end may be "character".[#开始和结束可能是“字符”。]
window(x, start = "2003-02-01")
## zooreg example (with plain numeric index)[#zooreg例如(纯数字索引)]
z <- zooreg(rnorm(10), start = 2000, freq = 4)
window(z, start = 2001.75)
window(z, start = c(2001, 4))
## replace data at times of d0 which are in dn[#替换数据的D0是在DN的]
d1 <- d0 <- zoo(1:10) + 100
dn <- - head(d0, 4)
window(d1, time(dn)) <- coredata(dn)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|