getHeight {rBDAT} | R 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
|
... |
passing arguments to methods. |
Dx |
diameter of tree for which height is required; defaults to NULL |
bark |
logical, if TRUE given diameter |
mapping |
mapping of variable names in case a data.frame is given into
parameter |
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)
: transformingdata.frame
before callinggetHeight
usingbuildTree
-
getHeight(list)
: transforminglist
before callinggetHeight
usingbuildTree
-
getHeight(datBDAT)
: class method for classdatBDAT
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)