Produces a feature spec that extracts the value from the most recent
(latest) record matching the concept set. Ordered by the table's date
column, the last record's value_column is returned. Commonly
used for lab measurements where the latest reading is clinically
relevant (e.g. most recent HbA1c).
Arguments
- concept_set
Numeric vector of concept IDs, or an
omop_concept_setobject defining the concepts to match.- value_column
Character; name of the column from which to extract the value (default
"value_as_number").- name
Character; optional custom name for the feature column. If
NULL, auto-generated from the concept and table context.
Examples
if (FALSE) { # \dontrun{
spec <- omop.feature.latest_value(c(3004410),
value_column = "value_as_number")
plan <- ds.omop.plan.features(plan, "labs",
"measurement", specs = list(latest_glucose = spec))
} # }