TallestTrees | R Documentation |
This function calculates the average height of the 100 tallest trees in your data set. Using the EXPF and HTs provided the 100 tallest trees will be identified and averaged. This mean value will then be returned as a variable listing the average of the tallest trees within the plot as an observation for each tree in your data set.
TallestTrees(ID, HT, EXPF)
ID |
Unique Plot ID for each plot in your data set. |
HT |
Height of each tree in meters. |
EXPF |
Expansion factor of each tree. |
This function uses the dplyr package to select, arrange, and mutate the data.
Your data should include unique IDs specific to each plot. If you have not done this, it can be done using the Unique.ID function included in this package. This function requires either a measured or predicted height for each tree in your inventory. If you have not added predicted values where this is no tree HT measurement, use the Height Predict function in this package.
The function returns a vector of length n with the 100 tallest trees in each plot.
Ryan Smith
Unique.ID
HeightPredict
EXP.F
Other Plot Level Functions:
BA.Larger.Trees()
,
BAPH()
,
CCF.Larger()
,
CrownCompF()
,
DBHFuns()
,
HeightPredict()
,
RD()
,
SDI.Max()
,
SDI.Plot()
,
TPH()
,
Unique.ID()
## Not run: ###### RUNNING THE SCRIPT ###### ###### REQUIRES FULL VECTORS ##### ###### AS SEEN HERE ###### trees$Tallest <- TallestTrees(trees$ID, trees$HT, trees#EXPF) ##### RUN WITH FULL VECTORS AND NOT WITH MAPPLY ##### # If you don't have predicted heights or IDs data(tree_data) trees <- tree_data cord <- data.frame(trees$X, trees$Y) sp::coordinates(cord) <- cord sp::proj4string(cord) <- sp::CRS("+proj=longlat +datum=WGS84") CSI <- raster::raster("EastSI_ENSEMBLE_rcp60_2030.tif") CSIdata <- raster::extract(CSI, cord, method = 'simple', df = TRUE) trees$CSI <- CSIdata$EastSI_ENSEMBLE_rcp60_2030 trees <- trees %>% dplyr::mutate( EXPF = EXP.F(DBH, BAF), BA = BA(DBH), CCF = CrownCompF(Stand, Plot, Tree, SPP, DBH, EXPF), ID = Unique.ID(Stand, Plot), ) trees <- trees %>% dplyr::group_by(ID) %>% dplyr::arrange(desc(DBH), .by_group = TRUE) trees <- trees %>% dplyr::mutate( BAL = BA.Larger.Trees(ID, DBH, BA) ) trees$HT <- HeightPredict(trees$SPP, trees$DBH, trees$CSI, trees$CCF, trees$BAL, trees$Plot, trees$HT) trees$Tallest <- TallestTrees(trees$ID, trees$HT, trees#EXPF) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.