Skip to contents

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

Usage

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

Arguments

data

A data frame of weight observations, one row per plant.

x_name

A string naming the data for error messages.

Value

data, invisibly.

Details

Required columns:

  • fronds, the number of fronds reaching 1 m above the holdfast (whole number >= 1).

  • weight_kg, the plant's weight (kg, > 0).

  • site, the site the plant was sampled at (any text).

  • year, the year the plant was sampled (whole number or text).

Other columns are ignored.

Examples

data <- data.frame(
  fronds = c(3, 8), weight_kg = c(0.4, 1.7),
  site = factor(c("a", "b")), year = c(2020, 2021)
)
kb_check_data_weight_macro(data)