Produces a derived variable that computes age from year_of_birth.
With reference = "today", the constructor records today's ISO date
in the recipe so later executions remain reproducible.
With reference = "index", age is computed relative to the cohort
start date.
Usage
omop_variable_age(
name = "age",
reference = c("today", "index"),
reference_date = NULL,
year = NULL
)Arguments
- name
Character; output column name (default
"age").- reference
Character;
"today"or"index".- reference_date
Date or
NULL; explicit reference date (overridesreference). Only the year is used for age.- year
Integer or
NULL; convenience shorthand forreference_datewhen you only care about a data-collection year (e.g.year = 2024). Overridesreference.
Examples
if (FALSE) { # \dontrun{
recipe <- omop_recipe(variables = omop_variable_age(),
outputs = omop_output(type = "wide"))
} # }