Learn R Programming

dplR (version 1.8.0)

window.rwl: 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 rwl
window(x, start = NULL, end = NULL, ...)

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

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

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

Value

An object of the same class as x, holding the years from

start to end and the series with values in them.

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.

Author

Andy Bunn

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.

See Also

time.rwl, [.rwl, window

Examples

Run this code
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))

Run the code above in your browser using DataLab