getDiameter {rBDAT} | R 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 |
... |
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 |
mapping |
mapping of variable names in case a data.frame is given into
parameter |
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)
-
getDiameter(data.frame)
: transformingdata.frame
before callinggetDiameter
usingbuildTree
-
getDiameter(list)
: transforminglist
before callinggetDiameter
usingbuildTree
-
getDiameter(datBDAT)
: class method for classdatBDAT
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"))