Creates a named lookup list keyed by the values of key_var in
anchor_data. Each entry is a named character vector of the
corresponding row's columns. When multiple rows share the same key value
(e.g. duplicate USUBJID), the first row wins.
This is used internally by validate() when
anchor_datasets is supplied, making subject-level context available
across datasets without injecting columns.
Usage
build_anchor_index(anchor_data, key_var, call = rlang::caller_env())Value
A named list where each name is a unique key value and each element is a named character vector of that row's column values.
See also
Other conformance:
adam_rules(),
clear_ct(),
fda_rules(),
fetch_core_rules(),
fetch_herald_rules(),
herald_rules_cache_dir(),
list_ct(),
load_herald_config(),
new_herald_context(),
pmda_rules(),
register_ct(),
register_operator(),
rule_catalog(),
rule_config(),
update_core_rules(),
validate(),
validate_spec(),
validate_spec_define(),
validation_report(),
verify_html_report()
Examples
dm <- data.frame(
USUBJID = c("S1-001", "S1-002"),
AGE = c(45L, 62L),
SEX = c("M", "F"),
stringsAsFactors = FALSE
)
idx <- build_anchor_index(dm, "USUBJID")
idx[["S1-001"]][["AGE"]] # "45"
#> [1] "45"
