window.rwl: Take a Span of Years

View source: R/window.rwl.R

window.rwlR Documentation

Take a Span of Years

Description

Take the years from start to end of an "rwl", "rwi", "bai" or "crn" object.

Usage

## S3 method for class 'rwl'
window(x, start = NULL, end = NULL, ...)

## S3 method for class 'rwi'
window(x, start = NULL, end = NULL, ...)

## S3 method for class 'bai'
window(x, start = NULL, end = NULL, ...)

## S3 method for class 'crn'
window(x, start = NULL, end = NULL, ...)

Arguments

x

an object of class "rwl", "rwi", "bai" or "crn".

start, end

the first and last years to keep, each a single number. NULL means the first or last year of x.

...

not used.

Details

The years are those in time(x). The rows are taken with [, so an "rwl", "rwi" or "bai" object keeps its class and its provenance record, cut down to the years that remain (see [.rwl). Series with no values in the window are dropped from an "rwl", "rwi" or "bai" object, with a message naming them, since an empty series is not one any dplR function can use; if no series has values in the window, that is an error. The years returned are still the ones asked for. subset drops empty series in the same way. x[i, ] does not: [ returns every series it is asked for, empty or not, so that its columns stay lined up with anything indexed alongside them (see [.rwl). Use window to take years for analysis.

A window is usually taken to line the data up with something else, so a window that runs past either end of x gives a warning that says which years were returned, and a window that does not overlap x at all is an error.

Value

An object of the same class as x, holding the years from start to end and the series with values in them.

Author(s)

Andy Bunn

See Also

time.rwl, [.rwl, window

Examples

data(ca533)
ca533.1800s <- window(ca533, 1800, 1899)
range(time(ca533.1800s))
ca533.crn <- chron(detrend(ca533, method = "Spline"))
tail(window(ca533.crn, start = 1950))

dplR documentation built on Oct. 1, 2026, 9:07 a.m.