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