
Add days to death for individuals. Only death within the same observation period than indexDate will be observed.
Source: R/addDeath.R
addDeathDays.RdAdd 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{
library(PatientProfiles)
cdm <- mockPatientProfiles(source = "duckdb")
cdm$cohort1 |>
addDeathDays()
#> # Source: table<og_115_1775495291> [?? x 5]
#> # Database: DuckDB 1.5.1 [unknown@Linux 6.17.0-1008-azure:R 4.5.3/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 2 8 1966-03-28 1968-02-14
#> 2 2 6 1954-12-01 1955-02-06
#> 3 2 4 1924-02-16 1924-04-15
#> 4 3 2 1978-04-07 2002-03-19
#> 5 3 5 1988-11-02 1989-03-27
#> 6 1 3 1983-06-08 1992-01-31
#> 7 2 9 1939-03-16 1944-08-12
#> 8 1 7 1953-01-26 1959-12-07
#> 9 1 10 1905-05-25 1908-10-18
#> 10 1 1 1922-09-08 1922-11-05
#> # ℹ 1 more variable: days_to_death <dbl>
# }