age_in_years: Compute complete years between events.

Description Usage Arguments Value Examples

View source: R/percent.R

Description

Computes number of yearly anniversaries between two dates. Useful for computing tha age of a person at death or some other event.

Usage

1
age_in_years(begin_date, end_date)

Arguments

begin_date

Beginning date (usually birth).

end_date

Ending date (usually death).

Value

Number of anniversaries of begin_date (usually person's age).

Examples

1
2
3
4
5
6
7
8
# Dave Brubeck
age_in_years("1920-12-06", "2012-12-05")
# John F. Kennedy
age_in_years("1917-05-29", "1963-11-22")
# Elvis Presley
age_in_years("1935-01-08", "1977-08-16")
# Groucho Marx
age_in_years("1890-10-02", "1977-08-19")

mlaviolet/tidyepi documentation built on Feb. 8, 2021, 1:39 p.m.