Subscript a Time Series Object

DESCRIPTION:

Extract parts of a univariate or multivariate regularly spaced time series.

USAGE:

x[i]
x[i, j]
x[i, j, drop=T]

REQUIRED ARGUMENTS:

x
a time series of class "rts"
i
subscript expression, the index of observation times, used to identify which elements to extract or replace. The expression may be empty (meaning all possible subscripts), logical, numeric, or character.
j
subscript expression, the index of variables or channels, used to identify which elements to extract or replace. The expression may be empty (meaning all possible subscripts), logical, numeric, or character.

OPTIONAL ARGUMENTS:

drop
logical flag specifying whether dimensions of length 1 should be dropped: if TRUE (the default), subscripts of a single row (observation time) or channel (univariate series) are returned as a vector, if FALSE the result is a matrix or data frame.

VALUE:

extracts the subset of the time-series indicted by indices i and j.

DETAILS:

The result is a time-series only if the indices of time are in strictly increasing order. If the indices are not at regular intervals, the result will be an irregular time series, i.e. a time series of class "its".

Assignment is also possible, but no special methods are necessary for time-series classes.

SEE ALSO:

EXAMPLES:

hstart.rts <- as.rts(hstart)
halfyear.rts <- hstart.rts[seq(1, length(hstart), by=6)]

rain.low <- rts(corn.rain, start=1890, 
     names="rain")[corn.rain < mean(corn.rain)]
yield.low <- rts(corn.yield, start=1890,
     names="yield")[corn.yield < mean(corn.yield)]
ts.intersect(rain.low, yield.low)

votes.rts <- rts(t(votes.repub), start=1856)
southwest <- c("California","Nevada", "Utah",
     "New Mexico", "Arizona", "Colorado")
votes.sw <- votes.rts[, southwest]

rts.ex <- rts(rnorm(7))
rts.ex[c(1, 4, 7)]
rts.ex[c(2, 3, 5, 6)]
rts.ex[rev(1:7)]