TallestTrees: Average Height of the 100 Tallest Trees

View source: R/TallestTrees.R

TallestTreesR Documentation

Average Height of the 100 Tallest Trees

Description

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.

Usage

TallestTrees(ID, HT, EXPF)

Arguments

ID

Unique Plot ID for each plot in your data set.

HT

Height of each tree in meters.

EXPF

Expansion factor of each tree.

Details

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.

Value

The function returns a vector of length n with the 100 tallest trees in each plot.

Author(s)

Ryan Smith

See Also

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()

Examples


## 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)



ryanmismith/inventoryfunctions documentation built on Aug. 5, 2022, 2:22 a.m.