# 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)
Run the code above in your browser using DataLab