
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{
library(PatientProfiles)
cdm <- mockPatientProfiles(source = "duckdb")
cdm$cohort1 |>
addDeathFlag()
#> # Source: table<og_104_1757798533> [?? 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 death
#> <int> <int> <date> <date> <dbl>
#> 1 1 9 1939-11-03 1950-08-15 0
#> 2 1 10 1947-12-06 1954-02-26 0
#> 3 2 7 1935-10-29 1935-11-30 0
#> 4 3 2 1956-02-04 1963-04-15 0
#> 5 1 1 1907-07-05 1914-12-28 0
#> 6 1 3 1952-06-04 1954-05-28 0
#> 7 2 5 1943-09-22 1961-09-23 0
#> 8 2 4 1955-03-20 1969-03-16 0
#> 9 1 6 1940-06-03 1944-02-09 0
#> 10 2 8 1929-09-16 1930-05-11 0
# }