as.bai: Basal Area Increment (bai) Objects

View source: R/as.bai.R

as.baiR Documentation

Basal Area Increment (bai) Objects

Description

Class "bai" holds basal area increment: the area of each ring, with one series per column and one year per row, as made by bai.in and bai.out. as.bai labels a data.frame or matrix of ring areas as one.

Usage

as.bai(x)

## S3 method for class 'bai'
x[i, j, drop]

## S3 method for class 'bai'
subset(x, subset, select, drop = FALSE, ...)

## S3 method for class 'bai'
time(x, ...)

## S3 method for class 'bai'
summary(object, ...)

## S3 method for class 'bai'
plot(x, plot.type = c("seg", "spag"), ...)

Arguments

x, object

for as.bai, a data.frame or matrix with series as columns and years as row names; for the methods, an object of class "bai".

i, j, subset, select, drop

as for [.rwl and subset.rwl.

plot.type

"seg" for seg.plot or "spag" for spag.plot.

...

for plot, passed to the plotting function. Otherwise not used.

Details

A "bai" object has the same shape as an "rwl" object and makes the same promise: the row names are the years, consecutive and increasing. It inherits from neither "rwl" nor "rwi", so that areas, widths and indices can be told apart.

dplR's functions use the class to check what they are given. Those that want ring-width indices, such as chron and rwi.stats, take a "bai" object without a word: a mean of basal area increment by year is a BAI chronology. So do the crossdating functions, the plots, common.interval, and detrend, since fitting a curve to basal area increment is established practice. Functions that want ring widths, such as bai.in, rcs, cms and rwl.report, warn and treat the areas as widths. If the values really are widths, relabel them with as.rwl.

Two attributes travel with it. attr(x, "dplR.bai") says how the areas were made: the function (fun) and whether the distance to pith (d2pith, for bai.in) or the diameters (diam, for bai.out) were given rather than estimated from the widths. attr(x, "dplR.provenance") is the provenance record of the ring widths the areas were made from, if they had one (see read.tucson). Neither is set by as.bai, which only labels the object.

Subsetting works as for "rwl" objects ([.rwl), and window takes a span of years (window.rwl). summary gives the per-series statistics of rwl.stats, in the units of the areas.

Value

as.bai: an object of class c("bai", "data.frame"). x is returned unchanged if it already has that class. time: a numeric vector of years. summary: a data.frame, as from rwl.stats.

Author(s)

Andy Bunn

See Also

bai.in, bai.out, as.rwl, as.rwi, chron

Examples

library(utils)
data(gp.rwl)
data(gp.d2pith)
gp.bai <- bai.in(rwl = gp.rwl, d2pith = gp.d2pith)
class(gp.bai)
str(attr(gp.bai, "dplR.bai"))
head(summary(gp.bai))
## A BAI chronology
gp.bai.crn <- chron(gp.bai)
plot(gp.bai.crn, add.spline = TRUE, nyrs = 32)
plot(gp.bai[, 1:5])

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