| standvar | R Documentation |
Computes stand-level variables for a given sample plot. The variables are the following: density, basal area, quadratic diameter diameter, average height, top height, and stand volume.
standvar(
data,
plot.id,
plot.area,
time = NA,
d,
y,
h = NA,
factvar = NA,
metric = TRUE,
eng = TRUE,
...
)
data |
data frame having the tree list of a sample plot. |
plot.id |
a string having the plot code-number or unique identificator. |
plot.area |
column name having the plot area in m |
time |
a number of year of measurement, if not provided the current year is assigned by default. |
d |
a text of the column-name having the diameter at
breast-heigth. By default is assumed to be in cm. See option
|
y |
a string-vector with the name(s) of the tree-level
variable(s) to which aggregated stand variables are needed
to be computed. For example, volume is such a variable. By
default is set to |
h |
a text of the column-name having the total height
of the tree. By default is set to NA. If provided this variable
is assumed to be measured in meters. See option
|
factvar |
a string having de name of the variable used as factor. Each level of the 'factvar' is a category. |
metric |
is a logic value, the default is to |
eng |
logical; if |
... |
aditional options for basic stats functions. |
For a given imputed tree list of a sample plot, several stand-level variales are computed. Note that the imputed-tree list must have all the tree-level variables needed to obtain the stand-level ones, such as, height, and volume. If there remeasurement for a plot, the computation is by plot and measurement year.
Returns a data frame with the the stand variables
per plot. If factvar is provided, the stand variables
will be a also computed for each level of the factvar.
Dominant diameter and dominant height are computed using
the function domvar().
Christian Salas-Eljatib.
Salas-Eljatib C. 2025. Biometría y Modelación Forestal. Borrador de libro, en revisión. 352 p.
df<-biometrics::eucaplot2
#see the metadata by typing ?eucaplot2
head(df)
datana::descstat(df[,c("dap","atot")])
## Preparing the treelist, in the required format
df$parce<-1;df$sup.plot<-500
## Estimating tree-volume using an artifical factor form
df$vol<-gtree(x=df$dap)*df$atot*0.35
## Using the function
standvar(data=df,plot.id="parce",plot.area="sup.plot",
d="dap",h="atot",y="vol")
# Do the same as before, but adding the computation by a factor
standvar(data=df,plot.id="parce",plot.area="sup.plot",
d="dap",h="atot",y="vol",factvar = "clase.copa")
## More than one aggregated variable. For instance, adding biomass
## and tree carbon, aside of volume. A naive estimation
## of tree-biomass and carbon, could be
df$biom<-df$v*420 #(kg/m3)
df$carb<-df$biom*0.5 #50% of biomass is carbon
df
standvar(data=df,plot.id="parce",plot.area="sup.plot",
d="dap",h="atot",y=c("vol","biom","carb"))
#what if the sample plot has a remeasurement
df$measu.yr<-2025;df$measu.yr[1:5]<-2020
df
#' ## Using the function per measurement year
standvar(data=df,plot.id="parce",plot.area="sup.plot",
d="dap",h="atot",y=c("vol","biom","carb"),time="measu.yr")
# Do the same as before, but adding the computation by a factor
standvar(data=df,plot.id="parce",plot.area="sup.plot",
d="dap",h="atot",y=c("vol","biom","carb"),time="measu.yr",
factvar = "clase.copa")
# More than one plot
df<-biometrics::radiatapl2
table(df$parce)
## naive imputation of tree-height
df[is.na(df$atot),"atot"]<-df[is.na(df$atot),"dap"]*0.8
## Estimating tree-volume using an artifical factor form
df$vtot<-gtree(x=df$dap)*df$atot*0.35
datana::descstat(df[,c("dap","atot","vtot")])
df$sup.plot<-150
standvar(data=df,plot.id="parce",plot.area="sup.plot",
d="dap",h="atot",y="vtot")
standvar(data=df,plot.id="parce",plot.area="sup.plot",
d="dap",h="atot",y="vtot",factvar = "sanidad")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.