Learn R Programming

biometrics (version 1.0.3)

standvar: Function to compute stand-level variables for a given imputed-tree-list.

Description

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.

Usage

standvar(
  data,
  plot.id,
  plot.area,
  time = NA,
  d,
  y,
  h = NA,
  factvar = NA,
  metric = TRUE,
  eng = TRUE,
  ...
)

Value

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().

Arguments

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\(^{2}\).

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 metrics to change it to the imperial system.

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 NA, thus only stand basal area will be computed. For instance, if is a vector, y=c("vgross","vnet"), those variables must be present in the tree list as column names. Notice that the resulting stand variable accronimg for each variable will be "vgross.ha" and "vnet.ha", by default.

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 metrics to use the imperial system.

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 TRUE, thus the diameter d has to be in cm, and the resulting tree-level basal area will be in m\(^{2}\). If metric is FALSE, the diameter d has to be in inches, and the computed tree basal area will be in ft\(^{2}\).

eng

logical; if TRUE (by default), the language of some of the output-column names will be English; if "FALSE" will be Spanish. For instance, the levels of the factor-variable (factvar) is named "level"; otherwise will be "nivel".

...

aditional options for basic stats functions.

Author

Christian Salas-Eljatib.

Details

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.

References

  • Salas-Eljatib C. 2025. Biometría y Modelación Forestal. Borrador de libro, en revisión. 352 p.

Examples

Run this code

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")

Run the code above in your browser using DataLab