getDiameter: Get diameter in given height inside tree taper

getDiameterR Documentation

Get diameter in given height inside tree taper

Description

this function calculates the diameter inside or outside bark of in given height for a given tree

Usage

getDiameter(tree, ...)

## S3 method for class 'data.frame'
getDiameter(tree, Hx = NULL, bark = TRUE, mapping = NULL, ...)

## S3 method for class 'list'
getDiameter(tree, Hx = NULL, bark = TRUE, mapping = NULL, ...)

## S3 method for class 'datBDAT'
getDiameter(tree, Hx = NULL, bark = TRUE, mapping = NULL, ...)

Arguments

tree

either a data.frame, a list or an object of class datBDAT containing the variables needed to decribe a tree, i.e. spp, D1, H, and optionally H1, D2, H2. See buildTree for details and parameter mapping for mapping of variable names

...

passing arguments to methods.

Hx

height in tree for which diameter over or under bark is required; defaults to NULL

bark

logical, if TRUE returned diameter Dx is over bark, if FALSE returned diameter is under bark. Coerced to logical by as.logical(bark[1]).

mapping

mapping of variable names in case a data.frame is given into parameter tree between colnames(tree) and required parameter names. See details.

Details

if tree does not includes variable Hx, a full outer join is generated between both

Value

a matrix with one row for each tree and one column for each Hx given, holding the diameter over or under bark of provided height Hx inside stem taper. The matrix is simplified by [,,drop=TRUE], especially if Hx=NULL.

Methods (by class)

  • data.frame: transforming data.frame before calling getDiameter using buildTree

  • list: transforming list before calling getDiameter using buildTree

  • datBDAT: class method for class datBDAT

Examples

tree <- data.frame(spp = c(1, 1), D1 = c(30, 30), H = c(25, 25), Hx = c(1.3, 22.248))
getDiameter(tree, bark = TRUE)
getDiameter(tree, bark = FALSE)

tree <- data.frame(BDATCode = c(1, 1), dbh = c(30, 30), h = c(25, 25), Hx = c(1.3, 22.248))
getDiameter(tree, bark = TRUE, mapping = c("BDATCode" = "spp", "dbh" = "D1", "h" = "H"))

tree <- data.frame(BDATCode = c(1, 1), dbh = c(30, 30), h = c(25, 25))
Hx <- c(1.3, 22.248)
getDiameter(tree, Hx = Hx, bark = TRUE, mapping = c("BDATCode" = "spp", "dbh" = "D1", "h" = "H"))

rBDAT documentation built on Oct. 14, 2022, 5:07 p.m.