Description Usage Arguments Value Author(s) Examples
Convert dates to ages.
1 | date_to_age(dob, refdate = Sys.time())
|
dob |
'Date of Birth' |
refdate |
Reference date to compare |
Numeric, 'whole number' ages
Brendan Rocks rocks.brendan@gmail.com
1 2 3 4 5 6 7 8 9 10 | # The argument can take a single age
date_to_age("1952-04-29")
# Or a whole vector!
data(test_data)
test_data$age <- date_to_age(test_data$dob)
# Historical ages, too. How old were these people yesterday?
test_data$age <- date_to_age(test_data$dob, Sys.Date() - 1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.