| treestat | R Documentation |
factvar) per sample plot.Computes several descriptive statistics of variables at the tree-level per sample plot. It can also be be applied to compute them by levels of factor within each available plot.
treestat(
data,
plot.id,
t = NA,
y,
d = NA,
factvar = NA,
full = FALSE,
short.names = TRUE,
metric = TRUE,
eng = TRUE,
want.add.d = FALSE,
want.add.g = FALSE,
...
)
data |
data frame having the tree list of a sample plot. |
plot.id |
a string having the plot code-number or unique identificator. |
t |
(optional) a time variable having the the measurement
year (in numeric or character format). The default is |
y |
a string-vector with the name(s) of the random
variable(s) to which the descriptive statistics will be
computed. By default uses |
d |
(optional) a text with the name of the column of the
|
factvar |
a string having de name of the variable used as factor. Each level of the 'factvar' is a category. |
full |
logical; if |
short.names |
logical; if |
metric |
is a logic value, the default is |
eng |
logical; if |
want.add.d |
logical; if |
want.add.g |
logical; if |
... |
aditional options for basic stats functions. |
For a given tree list of a sample plot, several descriptive statistics are computed for the selected random variables, by plot and measurement year.
Returns a data frame with the statistics per plot and
time for the selected y variables. If factvar is given, the
same statistics will be added but segregated by each level
(or category) of the factvar.
Christian Salas-Eljatib.
Salas-Eljatib C. 2025. Biometría y Modelación Forestal. Borrador de libro, en revisión. 352 p.
# Dataframe to be used
df<-biometrics::eucaplot2
#?eucaplot2
head(df)
datana::descstat(df[,c("dap","atot")])
df$parce<-1
## Using the function
treestat(data=df,plot.id="parce",y="atot")
# Now, for two random variables, instead of a single one
treestat(data=df,plot.id="parce",y=c("dap","atot"))
# If the d is provided, Do you want to add both the diameter
# and the basal area (g), as random variables?
treestat(data=df,plot.id="parce",y="atot",d="dap",want.add.d=TRUE,want.add.g=TRUE)
## Do the same as before, but adding the computation by a factor
treestat(data=df,plot.id="parce",y="atot",factvar="clase.copa")
df$time<-2025;df$time[1:5]<-2020
df
## Using the function per measurement year
treestat(data=df,plot.id="parce",y="atot",t="time",full=TRUE)
# Do the same as before, but adding the computation by a factor
treestat(data=df,plot.id="parce",y="atot",t="time",
factvar="clase.copa",full = TRUE)
## same as before, but for two random variables
treestat(data=df,plot.id="parce",y=c("dap","atot"),t="time",
factvar="clase.copa",full = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.