| check_study | R Documentation |
Run check_spec() over every dataset in a study and return one stacked
findings frame. Where check_spec() answers "does this dataset conform?",
check_study() answers "is my whole study submittable?" in a single pass,
surfacing every dataset's divergences at once instead of one abort at a
time. The result is an ordinary findings frame underneath, so filter it by
severity or hand it straight to repair_spec().
check_study(
spec,
data,
decode = c("none", "to_decode", "to_code"),
checks = NULL
)
spec |
The specification to check against. |
data |
The study's datasets. |
decode |
Which codelist column to check against. |
checks |
Which conformance dimensions to run.
|
One row per divergence, every dataset stacked. Each dataset's findings
carry its name in the dataset column, so the frame is the union of the
per-dataset check_spec() results. Printing renders the dataset-by-check
count matrix (the study-level summary); the underlying frame is unchanged.
Data-requiring, like check_spec(). check_study() checks data
against the spec, so it needs the data frames. For the spec's own
structural integrity (no data), use validate_spec().
A <artoo_study_findings> data frame with the same columns as
check_spec() (check, dimension, severity, dataset, variable,
message), one row per divergence across all datasets. Zero rows means
the whole study conforms. Print it for the count matrix; treat it as an
ordinary data frame otherwise.
One dataset: check_spec(). Spec structure only: validate_spec().
Repair: repair_spec() to apply the integer fixes the matrix surfaces.
# ---- Example 1: scan a whole study in one pass ----
#
# Loop the conformance check over every dataset's data. A fractional AGE
# (the spec types it integer) surfaces as an integer_fraction finding; the
# print is a dataset-by-check count matrix.
adsl <- cdisc_adsl
adsl$AGE <- adsl$AGE + 0.5
check_study(adam_spec, list(ADSL = adsl, ADAE = cdisc_adae))
# ---- Example 2: feed the findings straight into repair_spec() ----
#
# The result is an ordinary findings frame, so repair_spec() consumes it to
# flip every integer_fraction / integer_overflow variable across the study.
findings <- check_study(adam_spec, list(ADSL = adsl))
fixed <- repair_spec(adam_spec, findings)
spec_variables(fixed, "ADSL")$data_type[
spec_variables(fixed, "ADSL")$variable == "AGE"
]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.