Learn R Programming

rBDAT (version 1.0.0)

getDiameter: 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 data.frame getDiameter(tree, Hx = NULL, bark = TRUE, mapping = NULL, ...)

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

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

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.

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.

Methods (by class)

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

  • getDiameter(list): transforming list before calling getDiameter using buildTree

  • getDiameter(datBDAT): class method for class datBDAT

Details

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

Examples

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

Run the code above in your browser using DataLab