data_checker: Set of checks to perform on the data to make sure it can be...

View source: R/data_checker.R

data_checkerR Documentation

Set of checks to perform on the data to make sure it can be handled by hellometry()

Description

Will fail if any condition not met

Usage

data_checker(dats, biomass_type, model)

Arguments

dats

Dataframe to be used for estimation

biomass_type

"dry"/"wet". Whether the biomass used in inference should be dry (default) or wet. See dry_wet() for details.

model

"lm"/"poisson". What kind of allometric model should be computed. See full_estimation_table() for details.

Value

An error if any check fails.

Examples

# Data named the way the package expects
dats <-
  data.frame(species = c("sp_a", "sp_b"),
             stage = "larva",
             abundance = c(2, 5),
             size_col = c("3.1", "unknown"),
             biomass_col = c(0.4, NA),
             biomass_type = "dry")

# Passes quietly
data_checker(dats, biomass_type = "dry", model = "lm")

# Fails on a column that is not named properly
try(data_checker(dats["species"], biomass_type = "dry", model = "lm"))

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