validate¶
A rule-based data validation framework for R. Test files are .R scripts that confront() data against a validator() and leave validation objects in the environment. The runner emits one event per validation rule with per-row metrics. Scrutin auto-detects validate when a DESCRIPTION file and a tests/validate/ directory are both present.
Installing validate¶
validate is not shipped with Scrutin. Install it from CRAN:
Directory structure¶
Minimal example¶
tests/validate/test_cars.R
library(validate)
v <- validator(
speed_pos = speed > 0,
dist_pos = dist > 0,
speed_limit = speed < 25
)
result <- confront(cars, v)
Every top-level validation object left in the environment after sourcing is picked up by the runner. Each rule becomes a separate event.
Running¶
Configuration¶
No configuration is required. To override defaults in .scrutin/config.toml: