
Add days to death for individuals. Only death within the same observation period than `indexDate` will be observed.
Source:R/addDeath.R
addDeathDays.Rd
Add days to death for individuals. Only death within the same observation period than `indexDate` will be observed.
Usage
addDeathDays(
x,
indexDate = "cohort_start_date",
censorDate = NULL,
window = c(0, Inf),
deathDaysName = "days_to_death",
name = NULL
)
Examples
# \donttest{
cdm <- mockPatientProfiles()
cdm$cohort1 |>
addDeathDays()
#> # Source: table<og_096_1748639762> [?? x 5]
#> # Database: DuckDB v1.2.2 [unknown@Linux 6.11.0-1015-azure:R 4.5.0/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 2 3 2008-01-21 2010-01-02
#> 2 2 8 1943-02-08 1952-07-11
#> 3 3 7 1945-08-14 1954-11-08
#> 4 2 1 1978-05-25 1978-06-12
#> 5 2 6 1958-05-13 1977-09-22
#> 6 2 5 2010-03-30 2012-08-18
#> 7 3 10 2002-02-24 2009-03-01
#> 8 1 4 1920-05-27 1922-11-18
#> 9 2 2 1994-12-02 1995-05-13
#> 10 1 9 1923-01-23 1923-01-30
#> # ℹ 1 more variable: days_to_death <int>
mockDisconnect(cdm = cdm)
# }