Skip to contents

Add survival information to a cohort table

Usage

addCohortSurvival(
  x,
  cdm,
  outcomeCohortTable,
  outcomeCohortId = 1,
  outcomeDateVariable = "cohort_start_date",
  outcomeWashout = Inf,
  censorOnCohortExit = FALSE,
  censorOnDate = NULL,
  followUpDays = Inf
)

Arguments

x

cohort table to add survival information

cdm

CDM reference

outcomeCohortTable

The outcome cohort table of interest.

outcomeCohortId

ID of event cohorts to include. Only one outcome (and so one ID) can be considered.

outcomeDateVariable

Variable containing date of outcome event

outcomeWashout

Washout time in days for the outcome

censorOnCohortExit

If TRUE, an individual's follow up will be censored at their cohort exit

censorOnDate

if not NULL, an individual's follow up will be censored at the given date

followUpDays

Number of days to follow up individuals (lower bound 1, upper bound Inf)

Value

Two additional columns will be added to x. The "time" column will contain number of days to censoring. The "status" column will indicate whether the patient had the event (value: 1), or did not have the event (value: 0)

Examples

# \donttest{

cdm <- mockMGUS2cdm()
#> ■■■■■■■■■■■■■■■■■■■■■■■■■         80% | ETA:  1s
cdm$mgus_diagnosis <- cdm$mgus_diagnosis %>%
  addCohortSurvival(
    cdm = cdm,
    outcomeCohortTable = "death_cohort",
    outcomeCohortId = 1
  )
  # }