gdd_check: Check Developmental Data (Long Format) Before Fitting

View source: R/gdd_check.R

gdd_checkR Documentation

Check Developmental Data (Long Format) Before Fitting

Description

Non-stopping validation of a long-format development data frame (one row per observation with temperature and duration columns), i.e. the layout required by gdd_calc. Reports per-row problems (missing / non-numeric / non-positive values), a per-group summary (sample sizes, temperature coverage) and a linear-range check: if the highest mean developmental rate is not reached at the highest temperature, the data contain a high-temperature decline and the linear model must not be fitted to the full range.

Usage

gdd_check(data, temp_col = NULL, duration_col = NULL, by = NULL)

Arguments

data

A data.frame with temperature and duration columns.

temp_col, duration_col

Column names (auto-detected by default).

by

Optional grouping variable(s), as in gdd_calc.

Value

A list:

valid

logical vector, one entry per row of data

problems

data.frame (row, column, reason); empty if none

group_summary

data.frame per group: n, n_temp, temperature and duration ranges

linear_check

data.frame per group: temperature of the maximal mean rate, highest temperature, rate_declines flag

data

the valid rows, standardised to columns temp / duration / rate / group (NULL if no valid row remains)

See Also

gdd_read, gdd_calc

Examples

f <- system.file("extdata", "gdd_example.csv", package = "insectecol")
chk <- gdd_check(gdd_read(f), by = "stage")
chk$group_summary   # per-group sample sizes and ranges
chk$linear_check    # is the maximal mean rate at the highest temperature?

insectecol documentation built on Oct. 5, 2026, 5:08 p.m.