
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{
library(PatientProfiles)
cdm <- mockPatientProfiles(source = "duckdb")
cdm$cohort1 |>
addDeathDate()
#> # Source: table<og_092_1757798527> [?? x 5]
#> # Database: DuckDB 1.3.3-dev231 [unknown@Linux 6.11.0-1018-azure:R 4.5.1/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 3 1 1998-08-04 2003-02-07
#> 2 1 7 1951-09-13 1957-12-05
#> 3 1 9 1942-05-15 1949-11-25
#> 4 2 4 1935-03-30 1954-01-27
#> 5 1 10 1937-09-02 1941-10-14
#> 6 3 3 1926-01-02 1927-04-08
#> 7 2 8 1952-07-08 1954-06-09
#> 8 1 5 1954-12-17 1972-05-26
#> 9 1 6 1944-07-24 1946-07-25
#> 10 2 2 1936-01-11 1937-08-17
#> # ℹ 1 more variable: date_of_death <date>
# }