Skip to contents

Runs structural checks (row count, column list, missingness) and - when a config is supplied - value-conformance checks against the value: blocks in the YAML. Each concern is handled by a dedicated internal helper so individual checks can be tested and extended without touching the others.

Usage

validate_dataset(dt, config = NULL, dataset_label = "")

Arguments

dt

A cleaned data.table (output of clean_dataset()).

config

Config object from load_config(). Pass NULL to skip value conformance checks.

dataset_label

Optional string label for the report heading.

Value

dt invisibly, so the function can be used inline in a pipeline.

Examples

if (FALSE) { # \dontrun{
yml <- system.file("extdata", "variable_map.yml", package = "cuci")
csv <- system.file("extdata", "test-data.csv",    package = "cuci")
cfg <- load_config(yml)
raw <- data.table::fread(csv)
out <- clean_dataset(raw, cfg)
validate_dataset(out$data, cfg, "test-data")
} # }