Sources the R file specified by config$custom_checks_file, which must
define a function custom_checks(df) returning a list of
dq_result objects. Returns an empty list if
custom_checks_file is not set in the config.
Arguments
- df
A data frame. The current delivery.
- config
Named list. Merged configuration as returned by
load_config.
Value
A list of dq_result objects (may be empty).
Details
The file is sourced into an isolated environment whose parent is
baseenv(), so only base R functions are available by default.
dq_result is explicitly injected and can be called without
qualification. All other dqcheckr exports (e.g. resolve_col_type,
infer_col_type) must be qualified: dqcheckr::resolve_col_type().
Any error – missing file, undefined function, runtime failure, or a
malformed result element (each element must have the seven
dq_result fields and a valid status) – stops the run with a
clear message.
Examples
cfg_dir <- system.file("demonstrations/config", package = "dqcheckr")
cfg <- load_config("starwars_csv", config_dir = cfg_dir)
path <- system.file("demonstrations/data/starwars.csv", package = "dqcheckr")
df <- read_dataset(path, cfg)
results <- run_custom_checks(df, cfg)