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_096_1734613816> [?? x 5]
#> # Database: DuckDB v1.1.3 [unknown@Linux 6.8.0-1017-azure:R 4.4.2/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 3 5 1983-08-14 1985-03-14
#> 2 2 10 1932-03-19 1937-06-18
#> 3 3 6 1982-10-28 1984-11-23
#> 4 3 1 1970-09-08 1973-10-24
#> 5 2 9 1964-12-08 1965-01-03
#> 6 1 8 1973-11-18 1986-04-14
#> 7 2 2 1971-11-12 1986-09-18
#> 8 2 4 1982-09-22 1982-10-23
#> 9 1 3 1949-03-02 1950-06-16
#> 10 2 7 1961-07-25 1987-09-14
#> # ℹ 1 more variable: date_of_death <date>
mockDisconnect(cdm = cdm)
# }