Preflight readiness check for ODA / CTA analysis
Source:R/production_tools.R
oda_readiness_check.RdValidates a predictor frame, class vector, and optional weight vector before fitting. Returns a structured report. Does not modify inputs.
Usage
oda_readiness_check(
X,
y,
w = NULL,
miss_codes = NULL,
binary_only = FALSE,
min_class_n = 5L
)Arguments
- X
Data frame of predictors.
- y
Integer class/group vector.
- w
Optional numeric weight vector.
- miss_codes
Numeric vector of missing-code values (default
NULL).- binary_only
Logical; flag > 2 classes as an issue (default
FALSE).- min_class_n
Minimum observations per class; flags if any class is below this threshold (default
5L).
Value
Named list with:
ok (logical, TRUE if no issues),
issues (character vector),
warnings (character vector, non-fatal),
n_obs (integer),
group_report (from oda_validate_group()),
weight_report (from oda_validate_weights()),
attr_types (from oda_infer_attr_types()),
constant_attrs (character vector of constant columns).
Details
Flags:
Missing class/group variable.
Non-binary group when
binary_only = TRUE.Non-numeric weights, wrong-length weights, NA/Inf/zero weights.
Missing-code patterns in predictors (if
miss_codessupplied).Constant attributes (zero variance after miss-code removal).
Insufficient class counts (<
min_class_n).Attribute-type uncertainty (logical/factor columns).