age: Age in years of individuals

Description Usage Arguments Value Read more on our website! See Also Examples

View source: R/age.R

Description

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

Usage

1
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 comprehensive tutorial about how to conduct AMR analysis, the complete documentation of all functions (which reads a lot easier than here in R) and an example analysis using WHONET data.

See Also

age_groups to split age into age groups

Examples

1
2
df <- data.frame(birth_date = Sys.Date() - runif(100) * 25000)
df$age <- age(df$birth_date)

msberends/AMR documentation built on Feb. 15, 2019, 3:43 a.m.