Validates the minimal structure required by prepare_tam() and fit_tam().
The obs object must be a list containing data.frames catch, index,
weight, and maturity. Each table must include columns year, age,
and obs. Types must be numeric (integerish allowed) for year and age,
and numeric for obs.
Additional requirements:
index$samp_timeis required, numeric in [0, 1], and no NA.weight$obsandmaturity$obsmust not containNA.Optional
maturity$spawn_timemust contain finite numeric fractions in[0, 1]for every year and age. Absence means zero; seeprepare_tam().Non-missing observations must be finite and non-negative; maturity must be a proportion in
[0, 1]. Zero catch/index values are accepted here but treated as missing byprepare_tam(), because the observation model is on logs.catchandmaturitymust contain exactly one row for every(year, age)combination over the global modeled range (from min to max year and age across all tables). Weight requires the same grid within each supplied type.Survey tables may omit year-age combinations.
Optional
weight$typecontains"stock"or"catch". Stock weights are required. With types, the unique key is(year, age, type)and every supplied type must cover the complete same grid. Without types, or with stock alone, stock weights also supply yield and catch targets.Optional
catch$fleetadds fleet to its unique key and requires a complete year-age grid within every fleet.weight$fleetcan identify complete fleet-specific catch weights; stock weights remain unlabelled (NA).Optional character
unitcolumns must be consistent throughout catch and weight, and within each survey. Missing columns are valid; a supplied column requires nonempty labels on every row. Units never change input values. Seeas_tam_data()for units of derived quantities.
On failure the function aborts with a cli error. On success, it prints a
concise summary and returns TRUE invisibly. Use quiet = TRUE to suppress
the success summary; validation errors are always reported.
Examples
data(cod_obs)
check_tam_data(cod_obs)
#> ✔ Input data passed validation.
#> ℹ Years 1954-2025; ages 0-20; fleets: 1; surveys: 1.
check_tam_data(cod_obs, quiet = TRUE)