
Add date of death for individuals. Only death within the same observation period than indexDate will be observed.
Source: R/addDeath.R
addDeathDate.RdAdd 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_109_1775495288> [?? x 5]
#> # Database: DuckDB 1.5.1 [unknown@Linux 6.17.0-1008-azure:R 4.5.3/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 2 9 2012-05-07 2012-07-16
#> 2 1 3 1948-04-05 1951-04-14
#> 3 1 6 1929-06-16 1931-10-18
#> 4 3 7 1946-01-11 1953-11-16
#> 5 2 5 1955-08-27 1972-08-29
#> 6 2 1 1984-03-26 1989-11-03
#> 7 1 10 1935-03-04 1940-12-24
#> 8 2 8 1993-01-30 1993-04-19
#> 9 2 2 1960-01-23 1966-01-18
#> 10 2 4 1960-02-16 1973-05-14
#> # ℹ 1 more variable: date_of_death <date>
# }