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