vol_summarise: Summarize volume of trees

View source: R/vol_summarise.R

vol_summariseR Documentation

Summarize volume of trees

Description

This function can be used to summarize volume with and without bark of trees in a data frame.

Usage

vol_summarise(df, dbh, th, vwb, tree, .groups = NA, vwob = NA)

Arguments

df

A data frame.

dbh

Quoted name of the diameter at breast height variable, in cm.

th

Quoted name of the total height variable, in meters.

vwb

Quoted name of the volume with bark variable, in cubic meters.

tree

Quoted name of the tree variable. used to differentiate the trees' sections. If this argument is NA, the defined groups in the data frame will be used. Default: NA.

.groups

Optional argument. Quoted name(s) of additional grouping variables that can be added to differentiate subdivisions of the data.

vwob

Optional argument. Quoted name of the volume without bark variable, in cubic meters. Default: NA. If this argument is NA, the defined groups in the data frame will be used. Default: NA.

Value

A data frame summarized by the .groups variable(s).

Author(s)

Sollano Rabelo Braga sollanorb@gmail.com

See Also

Complementary functions: smalianwb, For calculation of volume with bark using the Smalian method, smalianwob, For calculation of volume without bark using the Smalian method, huberwb, for calculation of volume with bark using the Huber method, huberwob, for calculation of volume without bark the Huber method.

Examples

library(forestmangr)
data("exfm7")
head(exfm7)

# In order to calculate the volume of each tree, first we
# Calculate the volume by tree section using the Smalian method:
sec_data_vol <- exfm7 %>% 
smalianwb("di_wb", "hi", "TREE") %>% 
smalianwob("di_wb", "hi", "bark_t", "TREE", bt_mm_to_cm = TRUE)

sec_data_vol

# Now, we summarize the tree's volume:
vol_summarise(sec_data_vol, dbh = "DBH", th = "TH", vwb = "VWB",
tree = "TREE", .groups = "STRATA",vwob = "VWOB")

# It's possible to do everything using pipes:
exfm7 %>% 
smalianwb("di_wb", "hi", "TREE") %>% 
smalianwob("di_wb", "hi", "bark_t", "TREE", bt_mm_to_cm = TRUE) %>% 
vol_summarise("DBH", "TH", "VWB", "TREE", "STRATA", "VWOB")


forestmangr documentation built on Nov. 24, 2023, 1:07 a.m.