library(dplyr)
## Calculate spacing index for each plot
inventory_samples |>
summarise(
h0 = silv_stand_dominant_height(diameter, height),
ntrees = n(),
.by = plot_id
) |>
## calculate number of trees per hectare
mutate(ntrees_ha = silv_density_ntrees_ha(ntrees, plot_size = 14.1)) |>
mutate(spacing = silv_density_hart(h0, ntrees_ha))
Run the code above in your browser using DataLab