Aggregate a Handler to Plot Level
Description
Section titled “Description”Aggregates inventory data to the plot level. This is useful for creating
plot-level values for statistical models and other applications. Some
analyses, such as state-wide means or totals, do not require an explicit
aggregate() step.
Details
Section titled “Details”Bare variables (e.g., tree(VOLCFGRS)) are expanded using the per-acre
expansion factor, TPA_UNADJ, to produce a TPA-weighted sum per plot. This
is the standard FIA expansion. Function calls (e.g., tree(mean(VOLCFGRS)))
are passed to dplyr::summarise() using the active plot-level groupings,
allowing users to specify arbitrary aggregation functions without TPA
expansion. Functions that return a fiaplyr_target object, such as
grm_mortality() and grm_ingrowth(), encode
their own variable and expansion logic.
aggregate(handler, ...)Arguments
Section titled “Arguments”handler: A handler object....: A scope such astree(VOLCFGRS),tree(mean(VOLCFGRS)), ortree(grm_mortality(VOLCFGRS)), plus optional arguments such assparse = TRUE.
Examples
Section titled “Examples”# Standard TPA expansionhandler |> aggregate(tree(VOLCFGRS))
# Custom aggregation function without TPA expansionhandler |> aggregate(tree(mean(VOLCFGRS)))
# Weighted mean using TPA_UNADJhandler |> aggregate(tree(wm_ht = sum(TPA_UNADJ * HT) / sum(TPA_UNADJ)))