rForest: An R Package for Forest Inventory and Analysis
The rForest package provides functions to i) Fit a fifth-degree polynomial taper model, ii) plot tree stems in 2-D and 3-D, iii) plot taper models in 3-D.
#The development version:
library(devtools)
devtools::install_github("carlos-alberto-silva/rForest")
#The CRAN version:
install.packages("rForest")
#Loading rForest and rgl libraries
library(rForest)
library(rgl)
# Importing forest inventory data
data(ForestInv01)
# Subsetting Tree 1
tree1<-subset(ForestInv01,ForestInv01[,1]==1)
hi<-tree1$hi
di<-tree1$di
# Plotting stem 2d
plotStem2d(hi,di, col="#654321")
# setting model parametersdbh and ht
hi<-ForestInv01[,2]
di<-ForestInv01[,3]
ht<-ForestInv01[,4]
dbh<-ForestInv01[,5]
# fitting the fifth-degree polynomial taper model
fit <- poly5Model(dbh,ht,di,hi, plotxy=TRUE)
grid()
# Setting parameters for the 3-D visualization
dbh<-30 # cm
height<-25 # m
# Plotting the taper model in 3-D
VisTaperShape3d(model=fit,dbh=dbh,height=height,col="forestgreen",solid=TRUE)
box3d()
grid3d(c("x+","y+"))
aspect3d(0.3,0.3,1)
# Plotting the taper model in 3-D (solid=FALSE)
VisTaperShape3d(model=fit,dbh=dbh,height=height,col="forestgreen",solid=FALSE)
box3d()
grid3d(c("x+","y+"))
aspect3d(0.3,0.3,1)