Learn R Programming

DCC (version 1.2.1)

dcc_rerun: Re-run a cleaning pipeline from its manifest and verify the output

Description

Implements one-command reproducibility (design principle 7): reads the raw input again and verifies its hash, reloads and verifies the rule file, re-runs detect and execute with the recorded actions, and compares the cleaned data and audit log (excluding timestamps) against the manifest hashes. An input or rule file whose hash no longer matches raises a typed error -- changed inputs make reproduction claims meaningless.

Usage

dcc_rerun(manifest)

Value

A dcc_rerun object: list with reproduced (logical), data_match, audit_match, and the re-run result.

Arguments

manifest

A dcc_manifest, a dcc_result (a manifest is built from it first), or a path to a manifest YAML file.

See Also

dcc_manifest

Examples

Run this code
csv <- tempfile(fileext = ".csv")
writeLines(c("sid,score", "S1,90", "S2,150"), csv)
rules_file <- tempfile(fileext = ".yaml")
writeLines(c(
  "checks:",
  "  - id: R001",
  "    type: range",
  "    variable: score",
  "    min: 0",
  "    max: 100"
), rules_file)
if (requireNamespace("yaml", quietly = TRUE)) {
  x <- dcc_read(csv)
  f <- dcc_detect(x, dcc_rules(rules_file), id_var = "sid")
  res <- dcc_execute(x, f, actions = list(R001 = "set_na"),
                     id_var = "sid")
  # re-run from the manifest and confirm byte-identical reproduction
  dcc_rerun(dcc_manifest(res))$reproduced
}

Run the code above in your browser using DataLab