Find the element of nms
that looks like an age variable.
If no elements look like an age variable, or if
two or more elements do,
then return NULL
.
Arguments
- nms
A character vector
Value
An element of nms
, or NULL
.
Examples
find_var_age(c("Sex", "Year", "AgeGroup", NA)) ## one valid
#> [1] "AgeGroup"
find_var_age(c("Sex", "Year")) ## none valid
#> NULL
find_var_age(c("age", "age.years")) ## two valid
#> NULL