Runs every rule that applies to every dataset in the study, including the
ones that compare datasets against each other. Use this once the datasets
exist as files; to check a single dataset while you are still writing the
code that builds it, see check_dataset().
check_study(
study,
use_case = NULL,
max_records = 1000,
include_deprecated = FALSE
)Three tables:
findings - what is wrong. One row per problem, with Dataset,
Record, Variable, Value, the issue in words, and its triage.
Not in dataset under Value means the rule wanted a variable you do
not have, which is usually the finding itself.
skipped - what could not be checked, with a reason for each. Read
this one: an empty findings table can mean clean data or rules that
never ran, and they look identical otherwise.
truncated - rules that flagged more records than max_records kept,
with how many they really found.
A study folder path, or a study object from read_study().
Passing the path is the usual way; reading first is only worth it when
you want to check the same large study more than once without re-reading
it, or to look at what was parsed.
Optional use case (e.g. "INDH") to further filter
which rules apply, as in list_rules().
Most records to keep per rule, default 1000. A rule can
flag every row - a missing EPOCH on a 200 000-row LB is 200 000
identical findings, more than Excel can hold. The true count is kept in
truncated and the report shows it, so nothing is under-reported. Use
Inf for every record.
Also run rules CDISC has deprecated. FALSE by
default: a deprecated rule has a published replacement, so running both
reports the same defect twice.
Findings come back one row per (dataset, record, variable), pointing at the
exact spot. Some rules ask about a dataset as a whole rather than a
particular row - those leave Record blank. A few ask about the study as a
whole, such as "is DM present at all?"; those are answered once and reported
under Dataset = "STUDY" rather than repeated for every domain.
Rules comparing against a define.xml do run, as long as the study has one and
the xml2 package is installed. Without both, they are skipped with a reason
instead of being run against columns that are not there, which would report
problems that do not exist. The same goes for any rule needing an operator or
join coreval does not implement yet.
dir <- tempfile("coreval_study_")
dir.create(dir)
haven::write_xpt(data.frame(USUBJID = c("1", "2"), AGE = c(30, 65)), file.path(dir, "dm.xpt"))
result <- check_study(dir)
result$findings
unlink(dir, recursive = TRUE)
Run the code above in your browser using DataLab