compute_ba computes Basal Area according to user-specified grouping variables -e.g. Plot, species, etc- and time.

compute_ba(
  data,
  by = c("Plot", "binomial_name"),
  size_col = "size_corr",
  measure_type = getOption("measure_type"),
  time_col = getOption("time_col"),
  status_col = "status_corr",
  surface = 1.5625
)

Arguments

data

A data.frame containing a time-series tree-wise forest inventory -i.e. every line is a single tree measurement for a single year.

by

A character vector containing the name of the columns containing the variables -other than census time- according to which the result will be aggregated. Be it plots, subplots or species name...

size_col

character containing the name of the tree size measurements column -either circumference or diameter.

measure_type

A single character indicating whether tree sizes are given in circumferences -"C"- or diameter -"D"-.

time_col

A single character containing the name of the column corresponding to census years

status_col

Single character, the name of the column containing (corrected) tree life status

surface

Either a scalar containing the surface area of each plot -if they have the same dimensions- or a data.frame of the surface area according to some of the grouping variables -e.g. Plot and subplot. However, defaults to FALSE and in this case, only absolute BA is returned.

Value

A dataframe containing, for each combination of grouping variables, the plot-level and per-ha basal area for a given census year.

Examples

data("example_recruits") ba_plots <- suppressWarnings(compute_ba(example_recruits, size_col = "size_corr", measure_type = "C", time_col = "CensusYear", by = "Plot", surface = 1.5625)) ba_taxa <- suppressWarnings(compute_ba(example_recruits, size_col = "size_corr", measure_type = "C", time_col = "CensusYear", by = c("binomial_name","Plot"), surface = 1.5625)) str(ba_plots)
#> 'data.frame': 26 obs. of 6 variables: #> $ Plot : chr "1" "1" "1" "1" ... #> $ CensusYear : int 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 ... #> $ bys : chr "1_1984" "1_1985" "1_1986" "1_1987" ... #> $ absolute_basal_area: num 534998 539128 540480 537166 540480 ... #> $ surface_area : num 1.56 1.56 1.56 1.56 1.56 ... #> $ basal_area_per_ha : num 342399 345042 345907 343786 345907 ...
head(ba_taxa)
#> Plot CensusYear binomial_name bys #> 259 1 1984 Sandwithia_guyanensis Sandwithia_guyanensis_1_1984 #> 260 1 1985 Sandwithia_guyanensis Sandwithia_guyanensis_1_1985 #> 261 1 1986 Sandwithia_guyanensis Sandwithia_guyanensis_1_1986 #> 262 1 1987 Sandwithia_guyanensis Sandwithia_guyanensis_1_1987 #> 536 1 1988 Sandwithia_guyanensis Sandwithia_guyanensis_1_1988 #> 248 1 1989 Sandwithia_guyanensis Sandwithia_guyanensis_1_1989 #> absolute_basal_area surface_area basal_area_per_ha #> 259 5125.167 1.5625 3280.107 #> 260 5933.256 1.5625 3797.284 #> 261 5965.087 1.5625 3817.656 #> 262 6022.602 1.5625 3854.465 #> 536 6059.148 1.5625 3877.855 #> 248 5954.941 1.5625 3811.162