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_114_1730219847> [10 x 5]
#> # Database: DuckDB v1.1.1 [unknown@Linux 6.5.0-1025-azure:R 4.4.1/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date death
#> <int> <int> <date> <date> <dbl>
#> 1 3 4 1971-09-27 1990-08-29 0
#> 2 1 10 1975-10-13 1977-01-16 0
#> 3 3 8 1939-02-13 1943-09-07 0
#> 4 2 1 1957-08-08 1963-03-21 0
#> 5 2 3 1920-07-08 1921-08-01 0
#> 6 3 6 1933-03-17 1933-04-28 0
#> 7 1 7 2016-11-07 2023-10-18 0
#> 8 1 9 1991-03-27 2001-08-04 0
#> 9 2 2 1981-11-18 1995-08-28 0
#> 10 2 5 1983-05-05 1984-10-21 0
mockDisconnect(cdm = cdm)
# }