compute_age: Compute age values

View source: R/data_transformation.R

compute_ageR Documentation

Compute age values

Description

Computes the age given a birth year or a birth date

Usage

compute_age(x, age_spec = NULL, reference_year = NULL)

Arguments

x

a string or number vector to be transformed

age_spec

a string indicating the age specification, can be one of NULL, "age", "birthyear", or "date_of_birth". If this parameter is set to NULL, the function automatically tries to infers the specification

reference_year

a number indicating the reference year in order to compute the age from a birth year or birth date. If age_spec is "age", this parameter can be ignored.

Value

a numeric vector of ages


JLDC/logib documentation built on Jan. 12, 2025, 4:13 p.m.