Nothing
bai.out <- function(rwl, diam = NULL) {
rwl <- check.rwl(rwl, why = paste(
"Basal area is built up ring by ring from the widths, so from indices",
"it is not an area at all."))
if(!is.null(diam)) {
if(ncol(rwl) != nrow(diam))
stop("dimension problem: ", "'ncol(rw)' != 'nrow(diam)'")
if(!all(diam[, 1] == names(rwl))){
print(data.frame(rwlNames=names(rwl),seriesID=diam[,1],test=diam[, 1] == names(rwl)))
stop("series ids in 'diam' and 'rwl' do not match exactly.")
}
if(!is.data.frame(diam)){
stop("'diam' must be a data.frame")
}
diam.vec <- diam[, 2]
}
out <- rwl
## vector of years
n.vec <- seq_len(nrow(rwl))
for(i in seq_len(ncol(rwl))){
## series to work with
dat <- rwl[[i]]
## strip out data from NA
dat2 <- na.omit(dat)
## get diameter if not given
if(is.null(diam)) d <- sum(dat2)*2
else d <- diam.vec[i]
## get ring area
r0 <- d/2 - c(0, cumsum(rev(dat2)))
bai <- -pi*rev(diff(r0*r0))
## find NA / not NA locations
na <- attributes(dat2)$na.action
no.na <- n.vec[!n.vec %in% na]
## write result
out[no.na, i] <- bai
}
## AGB Sep 2026: class "bai" (see as.bai.R). 'out' started as a copy of
## the widths and so came back as class "rwl", which chron() and the other
## functions that check their input then took for widths.
make.bai(out, from = rwl,
how = list(fun = "bai.out", diam = !is.null(diam)))
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.