get_age: Returns a given individual's age at a given date

Description Usage Arguments Examples

Description

This function returns the age of a given individual (with known birth date) at a given date.

Usage

1
get_age(x, evdat = NA, round.digits = NA, evmat)

Arguments

x

Individual ID

evdat

Dates of interest in the Year-month-day format (e.g. "1850-01-01")

round.digits

Number of digits for rounding (default is NA, i.e. no rounding)

evmat

A matrix for event data (see codelinkget_evmat)

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
df_ind <- get_exmpl_df()
df_ind$bdate <- sample(seq(as.Date("1774-12-31"), as.Date("1874-12-31"), 100), nrow(df_ind))
df_fam <- data.frame(idf = c(0,unique(df_ind$momid[df_ind$momid>0])), fall = "C")
evmat <- get_evmat(df_ind, df_fam)
my_id <- sample_kh(df_ind, df_fam)
get_age(my_id, paste(df_ind$bdate[df_ind$id == my_id]+21*365-25), evmat)

## End(Not run)

johow/kinlab documentation built on July 5, 2019, 4:23 p.m.