Evaluates include fields on metadata items (domains, columns, rows, parameters)
and removes items where the condition evaluates to FALSE.
Usage
resolve_includes(x, info = list())Arguments
- x
A mighty_study or mighty_domain object.
- info
list()Named list of values used to evaluateincludeexpressions. For mighty_study, merged intox@study.
Details
Include conditions are R expressions with {glue} syntax for variable
substitution and evaluation. The info list provides the values used
to do this.
Examples
study <- mighty_study(
path = system.file("examples", package = "mighty.metadata")
)
# Add a conditional column
study$ADVS <- update_column(
study$ADVS,
id = "STUDYID",
include = "{study_id == 'my_study'}"
)
# Condition TRUE: column kept (study_id is "my_study" in @study)
study |>
resolve_includes() |>
getElement("ADVS") |>
list_columns()
#> [1] "USUBJID" "SAFFL" "TRTP" "VISITNUM" "AVISITN" "AVISIT"
#> [7] "PARAMCD" "PARAM" "AVAL" "AVALC"
# Condition FALSE: column removed
study |>
resolve_includes(info = list(study_id = "other")) |>
getElement("ADVS") |>
list_columns()
#> [1] "USUBJID" "SAFFL" "TRTP" "VISITNUM" "AVISITN" "AVISIT"
#> [7] "PARAMCD" "PARAM" "AVAL" "AVALC"
