
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_107_1740755706> [?? x 5]
#> # Database: DuckDB v1.2.0 [unknown@Linux 6.8.0-1021-azure:R 4.4.2/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date death
#> <int> <int> <date> <date> <dbl>
#> 1 3 4 1932-04-22 1947-12-02 0
#> 2 1 3 1972-04-04 1975-08-14 0
#> 3 3 10 1970-09-22 1970-11-08 0
#> 4 2 1 1971-06-05 1978-07-31 0
#> 5 1 5 1967-12-31 1972-02-23 0
#> 6 2 6 1969-11-13 1977-11-12 0
#> 7 3 2 2000-10-20 2003-01-17 0
#> 8 1 9 1954-04-20 1954-04-25 0
#> 9 2 7 1933-02-03 1944-09-03 0
#> 10 1 8 1941-11-26 1942-03-03 0
mockDisconnect(cdm = cdm)
# }