Calculates age in years based on a reference date, which is the sytem date at default.

age(x, reference = Sys.Date())

Arguments

x

date(s), will be coerced with as.POSIXlt

reference

reference date(s) (defaults to today), will be coerced with as.POSIXlt and cannot be lower than x

Value

Integer (no decimals)

Read more on our website!


On our website https://msberends.gitlab.io/AMR you can find a omprehensive tutorial about how to conduct AMR analysis and find the complete documentation of all functions, which reads a lot easier than in R.

See also

age_groups to split age into age groups