Skip to contents

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

Usage

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

Arguments

data

A data frame of nitrogen 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).

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

Other columns are ignored.

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

Examples

data <- data.frame(sample_mass_mg = c(2.4, 2.7), nitrogen_mass_ug = c(45, 52))
kb_check_data_nitrogen_macro(data)