
Add date of death for individuals. Only death within the same observation period than `indexDate` will be observed.
Source:R/addDeath.R
addDeathDate.Rd
Add date of death for individuals. Only death within the same observation period than `indexDate` will be observed.
Usage
addDeathDate(
x,
indexDate = "cohort_start_date",
censorDate = NULL,
window = c(0, Inf),
deathDateName = "date_of_death",
name = NULL
)
Examples
# \donttest{
cdm <- mockPatientProfiles()
cdm$cohort1 |>
addDeathDate()
#> # Source: table<og_091_1748639759> [?? x 5]
#> # Database: DuckDB v1.2.2 [unknown@Linux 6.11.0-1015-azure:R 4.5.0/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 2 9 1979-12-20 1983-10-29
#> 2 1 3 1995-07-27 1995-09-16
#> 3 1 2 1904-07-19 1916-04-16
#> 4 2 6 1985-09-30 1989-06-13
#> 5 2 4 1971-12-05 1986-10-03
#> 6 1 5 1928-03-31 1957-04-21
#> 7 1 10 1947-04-23 1948-11-03
#> 8 2 1 1975-01-17 1992-06-10
#> 9 1 7 1943-03-09 1961-03-01
#> 10 3 8 1976-04-10 1986-08-11
#> # ℹ 1 more variable: date_of_death <date>
mockDisconnect(cdm = cdm)
# }