window.tis: Time windows for Time Indexed Series

Description Usage Arguments Details Value Note Examples

View source: R/tis.R

Description

window.tis extracts the subset of the object x observed between the times start and end.

Usage

1
2
## S3 method for class 'tis'
window(x, start = NULL, end = NULL, extend = FALSE, noWarn = FALSE, ...)

Arguments

x

a tis object

start

the start time of the period of interest.

end

the end time of the period of interest.

extend

logical. If TRUE, the start and end values are allowed to extend the series. If FALSE, attempts to extend the series are ignored and a warning is issued unless noWarn is FALSE.

noWarn

logical. If FALSE (the default), warnings are generated if extend is FALSE and either (i) start is earlier than the start of the series or (ii) end is later than the end of the series.

...

other arguments to this function are ignored.

Details

The start and end times can be ti objects, or anything that ti(z, tif = tif, freq = frequency), can turn into a ti object.

Value

A tis object that starts and ends at the given times.

Note

The replacement method window<-.tis has not been implemented. Use the subscript operator with a ti argument to replace values of a tis object.

Examples

1
2
3
z <- tis(1:24, start = c(2001,1), freq = 12)
z2 <- window(z, start = 19991231, extend = TRUE) ## z2 extends back with NA's
window(z, end = end(z) - 3)

tis documentation built on Sept. 29, 2021, 1:06 a.m.