window.zoo {zoo} | R Documentation |
Methods for extracting time windows
of "zoo"
objects and replacing it.
## S3 method for class 'zoo': window(x, index = index.zoo(x), start = NULL, end = NULL, ...) ## S3 method for class 'zoo': window(x, index = index.zoo(x), start = NULL, end = NULL, ...) <- value
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. |
end |
an index/time value. Only the indexes in index
which are lower or equal to end are used. |
value |
a suitable value object for use with window(x) . |
... |
currently not used. |
Either the time window of the object is extracted (and hence return a "zoo"
object) or it is replaced.
## 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 ## zooreg example (with plain numeric index) z <- zooreg(rnorm(10), start = 2000, freq = 4) window(z, start = 2001.75) window(z, start = c(2001, 4))