getAssortment {rBDAT} | R Documentation |
Get assortments for one or many trees
Description
Function to get assortments given harvest specifications for a tree of dimension D1, possible D2, and H. Assortments could be diameter or length constrained.
Usage
getAssortment(tree, ...)
## S3 method for class 'data.frame'
getAssortment(tree, sort = NULL, mapping = NULL, value = "merge", ...)
## S3 method for class 'list'
getAssortment(tree, sort = NULL, mapping = NULL, value = "merge", ...)
## S3 method for class 'datBDAT'
getAssortment(tree, sort = NULL, mapping = NULL, value = "merge", ...)
Arguments
tree |
either an object of class 'datBDAT.assortment' or a data.frame or
list containing the variables needed, i.e. spp, D1, H, and optionally
H1, D2, H2 for specifying the tree. See |
... |
passing arguments to methods. |
sort |
named list with variables specifying assortments, see
|
mapping |
mapping of variable names in case a data.frame is given into
parameter |
value |
character vector indicating return type: either "Vol", "Skl", "Fix", "LDSort", "merge" (default) or "raw". See section Value. |
Details
Parameter 'tree' is able to take either a data.frame with correct
variables names or arbitrary names if mapping
is provided to map the
data.frame names to the required names by c("df-colname" = "var-name")
or to take a named list.
Assortments are calculated using BDAT2.0 Fortran routines. Slightly extended, it now is possible to return length and diameter information also about standard assortments (which are held in "Vol"-element of return list, if value="raw" or value="Vol").
The standard assortment names are:
X = non-usable wood at stem foot (X-Holz)
Sth = stem wood
Ab = upper part of stem wood, second length after transport cut
Ind = industrial wood
nvDh = non-usable coarse wood
Value
depending on value
either information about 'Skl,' 'Vol' or
'Fix' (these are elements of standard output of Fortran BDAT20 subroutine)
and, additionally, information about the 'Vol' elements is retrieved by
value="LDSort"
or
if value
= 'merge' than a combined information of all produced
assortments with name, base position, assortment length, mid-diameter,
top-diameter and volume is produced. This is most likely what you want,
hence the default. Standard output of BDAT is provided by value="raw"
.
Since v0.4.0 a vectorized BDAT-fortran-function is implemented, so each
element of the returned list in case of value="raw" keeps information of all
trees given. Make sure to appropriately split and manipulate this data.
Methods (by class)
-
getAssortment(data.frame)
: transformingdata.frame
before callinggetAssortment
usingbuildTree
-
getAssortment(list)
: transforminglist
before callinggetAssortment
usingbuildTree
-
getAssortment(datBDAT)
: class method for classdatBDAT
See Also
BDATVOLABMR
and BDATVOLABOR
for a
BDAT-type wrapper and function to keep back-compatability. To get coarse wood
volume over bark (>=7m diameter over bark) BDAT-type functions are
BDATVOLDHMR
and BDATVOLDHOR
.
Examples
tree <- data.frame(spp = 1, D1 = 30, H = 25)
sort <- list(Az = 7, Sokz = 1)
getAssortment(tree, sort, value = "Vol")
getAssortment(tree, sort, value = "Skl")
sort <- list(Az = 7, Sokz = 1, fixN = 1, fixZ = 10, fixL = 5,
fixA = 10, fixR = 1)
getAssortment(tree, sort, value = "Vol")
getAssortment(tree, sort, value = "Skl")
getAssortment(tree, sort, value = "Fix")
getAssortment(tree, sort, value = "LDSort")
getAssortment(tree, sort, value = "merge")
## prepare data for repeated sorting
## (get rid of preparating data handling)
n <- 3
tree <- data.frame(
spp = rep(1, n), D1 = seq(20, 50, length.out = n),
H = seq(15, 40, length.out = n)
)
sort <- list(lX = 0, Sokz = 1, Az = 7,
fixN = 2, fixZ = 10, fixL = 5,
fixA = 10, fixR = 1)
tree <- buildTree(tree = tree, check = "assortment", vars = sort)
getAssortment(tree, value = "Vol")
getAssortment(tree, value = "Skl")
getAssortment(tree, value = "Fix")
getAssortment(tree, value = "LDSort")
getAssortment(tree, value = "merge")
## to get bare BDAT-Output, use value='raw'
# very long list, each element keeping all trees
getAssortment(tree, value="raw")
# bonus: it returns the calling parameters as well