
Add flag for death for individuals. Only death within the same observation period than `indexDate` will be observed.
Source:R/addDeath.R
addDeathFlag.Rd
Add flag for death for individuals. Only death within the same observation period than `indexDate` will be observed.
Usage
addDeathFlag(
x,
indexDate = "cohort_start_date",
censorDate = NULL,
window = c(0, Inf),
deathFlagName = "death",
name = NULL
)
Examples
# \donttest{
cdm <- mockPatientProfiles()
cdm$cohort1 |>
addDeathFlag()
#> # Source: table<og_102_1750280278> [?? x 5]
#> # Database: DuckDB v1.3.0 [unknown@Linux 6.11.0-1015-azure:R 4.5.1/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date death
#> <int> <int> <date> <date> <dbl>
#> 1 3 5 1985-05-23 1990-06-24 0
#> 2 2 6 1946-05-04 1951-04-29 0
#> 3 3 1 1941-01-03 1947-06-10 0
#> 4 3 8 1923-12-17 1936-01-21 0
#> 5 2 7 1929-11-22 1933-09-29 0
#> 6 2 4 2001-05-03 2004-10-15 0
#> 7 3 10 2025-06-24 2026-08-15 0
#> 8 2 3 1959-12-05 1960-10-08 0
#> 9 2 9 2000-06-27 2004-09-06 0
#> 10 2 2 1921-12-04 1944-09-08 0
mockDisconnect(cdm = cdm)
# }