Internal helper. Asserts that x carries the pmx_stats class and exposes
the stats / obs / config slots in the expected shape. Subclass
validators pass their contract (class, required columns, required config
keys) through the optional arguments, so every container reports missing
pieces with the same messages, and then apply any checks of their own.
Usage
validate_pmx_stats(
x,
subclass = NULL,
source = NULL,
stats_cols = NULL,
obs_cols = NULL,
config_keys = NULL,
require_obs = length(obs_cols) > 0
)Arguments
- x
Object to validate.
- subclass
Optional subclass name
xmust carry (e.g."forest_stats").- source
Name of the function that builds
subclass, quoted in the class error (e.g."df_forest").- stats_cols
Columns
x$statsmust contain.- obs_cols
Columns
x$obsmust contain.- config_keys
Keys
x$configmust contain.- require_obs
Logical; whether
x$obsmust be a data.frame rather thanNULL. Implied by a non-emptyobs_cols.
