actual_spouse: Returns the ID of an individual's spouse at a fixed date

Description Usage Arguments Examples

Description

This function returns the ID of an individual's spouse at a fixed date (accounting for multiple marriages, if possible).

Usage

1
actual_spouse(x = NULL, evdat = NULL, df_ped = NULL, df_fam = NULL)

Arguments

x

An individual ID

evdat

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

df_ped

A dataframe

df_fam

A dataframe containing variables for date of union (dat4) and the IDs of the spouses (female: idf; male: codeidm)

Examples

1
2
3
4
5
6
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")
actual_spouse(sample_kh(df_ind, df_fam),
   paste(sample(df_ind$bdate, 1)),
   df_ind, df_fam)

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