Time Windows

Usage

window(x, start, end, frequency, deltat)

Arguments

x a time-series or other object.
start the start time of the period of interest.
end the end time of the period of interest.
frequency the new sampling frequency, which should be a sub-multiple of the original frequency.
deltat the new time interval between observations, which should be a multiple of the original frequency.

Description

window is a generic function which extracts the subset of the object x observed between the times start and end.

Details

The default method applies to objects with a tsp attribute, or vectors or matrices (which are assumed to have been observed at times 1 to NROW(x)).

The start and end times are rounded to the nearest sampling time. This is for S compatibility.

Value

An object with a tsp attribute, and with class that of the x unless (as for time series) that class is changed by subsetting. The ts ensures the result has class "ts".

See Also

time, ts.

Examples

data(presidents)
sixties <- window(presidents, 1960, c(1969,4))

data(sunspots)
## all June values in 20th century
window(sunspots, start=c(1901,6), frequency=1)


[Package Contents]