silv_sqrmean_diameter {silviculture} | R Documentation |
Calculates the squared mean diameter
Description
Calculates the squared mean diameter
Usage
silv_sqrmean_diameter(diameter, ntrees = NULL)
Arguments
diameter |
Numeric vector of diameters or diameter classes |
ntrees |
Numeric vector with number of trees of the diameter class per
hectare. If |
Value
A numeric vector
Examples
## calculate dg for inventory data grouped by plot_id and species
library(dplyr)
inventory_samples |>
mutate(dclass = silv_diametric_class(diameter)) |>
summarise(
height = mean(height, na.rm = TRUE),
ntrees = n(),
.by = c(plot_id, species, dclass)
) |>
mutate(
ntrees_ha = silv_ntrees_ha(ntrees, plot_size = 10),
h0 = silv_dominant_height(dclass, height, ntrees_ha),
dg = silv_sqrmean_diameter(dclass, ntrees_ha),
.by = c(plot_id, species)
)
## calculate dg for a vector of diameters
silv_sqrmean_diameter(c(12.5, 23.5, 14, 16, 18.5))
[Package silviculture version 0.1.0 Index]