getHeight: Get height of given diameter inside tree taper

getHeightR Documentation

Get height of given diameter inside tree taper

Description

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

Usage

getHeight(tree, ...)

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

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

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

Arguments

tree

either a data.frame or a list 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.

Dx

diameter of tree for which height is required; defaults to NULL

bark

logical, if TRUE given diameter Dx is considered over bark, if FALSE diameter is considered to be 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.

Details

see buildTree for how to specify a tree object

Value

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

Methods (by class)

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

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

  • getHeight(datBDAT): class method for class datBDAT

Examples

tree <- data.frame(spp = c(1, 1), D1 = c(30, 25), H = c(25, 20), Dx = c(7, 7))
getHeight(tree, bark = TRUE)
getHeight(tree, bark = FALSE)

tree <- data.frame(BDATCode = c(1, 1), dbh = c(30, 25), h = c(25, 20), Dx = c(7, 7))
getHeight(tree, bark = TRUE, mapping = c("BDATCode" = "spp", "dbh" = "D1", "h" = "H"))

tree <- data.frame(BDATCode = c(1, 1), dbh = c(30, 25), h = c(25, 20))
Dx <- c(7, 5)
getHeight(tree, Dx = Dx, bark = TRUE, mapping = c("BDATCode" = "spp", "dbh" = "D1", "h" = "H"))

tree <- data.frame(spp = c(1, 1), D1 = c(30, 25), H = c(25, 20), Dx = c(7, 7))
getHeight(tree, Dx = c(1:5), bark = TRUE)

rBDAT documentation built on May 29, 2024, 3:08 a.m.