Skip to contents

Check that data contains the columns required to fit the Macrocystis pyrifera carbon model, with appropriate types and values.

Usage

kb_check_data_carbon_macro(
  data,
  x_name = chk::deparse_backtick_chk(substitute(data))
)

Arguments

data

A data frame of carbon observations, one row per sample.

x_name

A string naming the data for error messages.

Value

data, invisibly.

Details

Each row is one dried tissue sample. Required columns:

  • sample_mass_mg, the mass of the dried tissue sample analysed (mg, > 0).

  • carbon_mass_ug, the mass of carbon measured in the sample (µg, > 0 and less than the sample mass).

Other columns are ignored.

A warning gives the number of samples whose carbon fraction (carbon mass over sample mass) falls outside 0.10 to 0.50, the plausible range for kelp tissue; they are kept.

Examples

data <- data.frame(sample_mass_mg = c(2.4, 2.7), carbon_mass_ug = c(760, 850))
kb_check_data_carbon_macro(data)