Description Usage Arguments Value Examples
View source: R/prepareTreeCompetitionTable.R
Prepares tree and competition variables from IFN tree data for model input (used internally in model functions like IFNgrowth
).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | prepareTreeCompetitionTable(
x,
BAL = TRUE,
BALext = FALSE,
sortByDBH = FALSE,
keep.vars = character(0),
provinceFromID = FALSE,
verbose = FALSE
)
prepareSpeciesCompetitionTable(x, provinceFromID = FALSE, verbose = FALSE)
prepareSpatialSpeciesCompetitionTable(
x,
nb,
NspNmatrix,
sigma = c(0.5, 1, 2, 4),
provinceFromID = FALSE,
verbose = FALSE
)
|
x |
a data frame with column names. |
BAL |
A flag to indicate that basal area of larger trees (between inventories) has to be calculated. |
BALext |
A flag to indicate that basal area of larger extracted trees (between inventories) has to be calculated (requires column 'OIFFIN' in |
sortByDBH |
A flag to sort rows within each plot by increasing diameter at breast height. |
keep.vars |
A character vector with names of variables in |
provinceFromID |
A flag to indicate that province should be extracted from 'ID' assuming they are IFN plot codes. |
verbose |
A flag to indicate console output during the process. |
nb |
An object of class |
NspNmatrix |
A numeric matrix with the density proportion of each species (columns) in each plot (rows). |
Function prepareTreeCompetitionTable
returns a data frame with as many rows as rows in the input x
object
and columns:
Province
: Spanish province code (will be empty if provinceFromID = FALSE
).
ID
: Plot code.
species
: Species code.
d
: Tree diameter at breast height.
inv.d
: Inverse of tree diameter at breast height.
ln.d
: Logarithm of tree diameter at breast height.
sq.d
: Square of tree diameter at breast height.
sqrt.d
: Square-root of tree diameter at breast height.
h
: Tree height (m).
inv.h
: Inverse of tree height.
ln.h
: Logarithm of tree height.
h.d
: Height to diameter ratio.
N
: Stand tree density.
BAL
: Basal area of trees larger than the target tree.
BAL.ln.d
: Basal area of larger trees divided by the logarithm of tree diameter.
BAL.ext
: Basal area of trees extracted in a previous step.
G
: Stand total basal area.
ln.G
: Logarithm of total basal area.
Additional columns may be returned if required using keep.vars
. Function prepareSpeciesCompetitionTable
returns a data frame with as many
rows as species in plots and columns:
Province
: Spanish province code (will be empty if provinceFromID = FALSE
).
ID
: Plot code.
species
: Species code.
G
: Stand total basal area.
ln.G
: Logarithm of total basal area.
ln.N
: Logarithm of stand total tree density.
Nsp.N
: Proportion of trees of the target species.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # Load example tree data and coordinates
data(exampleTreeData)
data(examplePlotCoords)
# Prepare input for growth/survival models
prepareTreeCompetitionTable(exampleTreeData)
# Prepare input for ingrowth models
prepareSpeciesCompetitionTable(exampleTreeData)
# Prepare input for ingrowth models including dispersal effects
nb = IFNknn(examplePlotCoords, k = 1)
Nmatrix = tapply(exampleTreeData$N, list(exampleTreeData$ID, exampleTreeData$Species),
sum, na.rm=T)
NspNmatrix = sweep(Nmatrix, 1, rowSums(Nmatrix, na.rm=T), "/")
NspNmatrix = rbind(NspNmatrix,c(0.5, NA, NA, NA))
rownames(NspNmatrix)[4] = "80003"
NspNmatrix = cbind(NspNmatrix, c(NA,NA,NA,0.5))
colnames(NspNmatrix)[5] = "25"
prepareSpatialSpeciesCompetitionTable(exampleTreeData, nb, NspNmatrix)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.