make_measurement_table: Build measurement table to be used for biomass estimations

View source: R/make_measurement_table.R

make_measurement_tableR Documentation

Build measurement table to be used for biomass estimations

Description

Compiles the table of numerical measurements used to estimate sizes and fit allometric models. The table is built entirely from the data you supply: every row with a numerical size_col is kept (expanded by abundance so each row represents one individual), carrying its taxonomy along.

Usage

make_measurement_table(dats, level_vec)

Arguments

dats

Dataframe to be used for estimation.

level_vec

Vector of taxonomic levels to be used in the measurement table.

Value

A table with measurements and taxonomy, ready to be used for size and biomass estimation.

Examples

# Reference measurements for one family, renamed to the columns the package expects
measurements <-
  bromeliad_inverts_measurements() %>%
  dplyr::filter(family == "Culicidae") %>%
  dplyr::rename(size_col = body_size_mm,
                biomass_col = body_mass_mg,
                biomass_type = mass_type) %>%
  dplyr::mutate(size_col = as.character(size_col),
                biomass_col = as.numeric(biomass_col))

# Taxa to estimate, with no measurement of their own
communities <-
  trini_communities() %>%
  dplyr::filter(family == "Culicidae") %>%
  dplyr::rename(abundance = n) %>%
  dplyr::mutate(size_col = "unknown",
                biomass_col = NA,
                biomass_type = "dry")

# The two together are what the package works on
dats <-
  combine_measurements(dats = communities, measurements = measurements)
level_vec <-
  c("species", "genus", "family")

# One row per measured individual, taxonomy carried along
make_measurement_table(dats = dats, level_vec = level_vec)

hellometry documentation built on Nov. 11, 2026, 5:06 p.m.