
Validate a cleaned survey dataset against the variable map
Source:R/validate_dataset.R
validate_dataset.RdRuns 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.
Arguments
- dt
A cleaned
data.table(output ofclean_dataset()).- config
Config object from
load_config(). PassNULLto skip value conformance checks.- dataset_label
Optional string label for the report heading.
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")
} # }