get_age | R Documentation |
For someone born May 1, 1990, what is their age on May 2, 2000? 10 years, but what if we want more precision? They are 1 day older, and May 1, 2001 is in 364 days, so they are 10 + 1/365 years old.
Things get more complicated when we include consideration of leap years, when the next birthday might be 366 days away.
get_age()
solves this problem.
Note that it assumes there are no leap centuries (and hence may will be incorrect for dates before March 1, 1900 or after February 28, 2100). It also takes the stance that leap babies (those born February 29) increment their age on March 1 in non-leap years.
get_age(birthdays, ref_dates)
birthdays |
A vector of |
ref_dates |
A vector of |
Numeric vector of years (including fractional parts) between each ref_dates
and birthdays
entry.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.