age_calc {kyotil} | R Documentation |
Age Calculation
Description
Calculate age, by Jason P Becker, modified very slightly in how arguments are passed to the function.
Usage
age_calc(dob, enddate = Sys.Date(), units = c("days","months","years"), precise = TRUE)
Arguments
dob |
POSIXlt or Date. Birthday |
enddate |
POSIXlt or Date. Date to compute age |
units |
string. Choose a unit. |
precise |
Boolean. |
Author(s)
Jason P Becker
References
http://blog.jsonbecker.com/2013/12/calculating-age-with-precision-in-r.html
Examples
age_calc (dob=strptime("29OCT2002", format="%d%b%Y"),
enddate=strptime("30OCT2003", format="%d%b%Y"), units='years', precise=TRUE)
age_calc (dob=strptime("29OCT2002", format="%d%b%Y"),
enddate=strptime("30DEC2003", format="%d%b%Y"), units='years', precise=FALSE)
[Package kyotil version 2024.5-8 Index]