Apply Schema Validation, Stopping on Fatal Issues
Source:R/lib_data_loader.R
apply_schema_validation.RdRuns validate_schema() and acts on the
result: fatal issues raise an error via stop(),
warning-severity issues emit a warning().
Arguments
- df_raw
The data frame to validate.
- provenance
A provenance list as returned by
load_provenance().
Value
Invisibly, TRUE if no issues were found and FALSE
otherwise. Errors if any fatal issue is present.
Examples
prov <- list(schema = list(expected_columns = "id"))
apply_schema_validation(data.frame(id = 1), prov)
# A missing required column is fatal:
try(apply_schema_validation(data.frame(x = 1), prov))
#> Error : Missing required columns: id