dbhMetric: Compute diameter, basal area, tree density, or height from...

dbhMetricR Documentation

Compute diameter, basal area, tree density, or height from tree measurements

Description

Convert raw tree diameter or height inputs into the compact metric formats used across basifoR workflows.

Usage

dbhMetric(dbh, met = "d", 
    design = snfi_design())

Arguments

dbh

numeric. Diameter at breast height in mm, or tree height in m when met = "h". Non-numeric inputs are coerced, zeros are treated as missing, and vectors are averaged after that replacement.

met

character(1). Metric to compute: mean diameter at breast height ("d"), basal area ("ba"), trees per hectare ("n"), or height ("h").

design

Object inheriting from "inventory_design", used only when met = "n" to derive the trees-per-hectare expansion factor. The default is the Spanish National Forest Inventory concentric subplot design.

Details

The sampling design affects only met = "n". For "d", "ba", and "h", the returned value does not depend on design.

Value

A single numeric value. Returns mean diameter in mm for met = "d", basal area in m^2 per tree for met = "ba", trees per hectare for met = "n", and height in m for met = "h". Returns NA_real_ when all supplied values are missing or become missing after zero replacement.

Author(s)

Wilson Lara [aut, cre] (ORCID: <https://orcid.org/0000-0003-3527-1380>), Cristobal Ordonez [aut] (ORCID: <https://orcid.org/0000-0001-5354-3760>), Aitor Vázquez-Veloso [aut] (ORCID: <https://orcid.org/0000-0003-0227-506X>), Felipe Bravo [aut] (ORCID: <https://orcid.org/0000-0001-7348-6695>)

Examples

dbhMetric(300, "d")
dbhMetric(300, "ba")
dbhMetric(18, "h")

dsg <- new_concentric_design(
    radii_m = c(4, 8, 12),
    min_dbh_cm = c(5, 15, 30),
    name = "3-subplot design"
)

dbhMetric(130, "n", design = dsg)

basifoR documentation built on Aug. 26, 2026, 9:06 a.m.

Related to dbhMetric in basifoR...