addCohortSurvival: Calculate survival data for a cohort

View source: R/addCohortSurvival.R

addCohortSurvivalR Documentation

Calculate survival data for a cohort

Description

Calculate survival data for a cohort

Usage

addCohortSurvival(
  connection,
  cdmDatabaseSchema,
  cohortDatabaseSchema,
  targetCohortTable,
  targetCohortId,
  outcomeCohortTable,
  outcomeCohortId = 1,
  outcomeDatabaseSchema = cohortDatabaseSchema,
  outcomeDateVariable = "cohort_start_date",
  outcomeWashout = Inf,
  minDaysToEvent = 0,
  censorOnCohortExit = FALSE,
  censorOnDate = NULL,
  followUpDays = Inf,
  includeAge = FALSE,
  includeGender = FALSE,
  observationPeriodTable = "observation_period",
  tempEmulationSchema = NULL,
  chunkSize = NULL,
  addDay = FALSE
)

Arguments

connection

DatabaseConnector connection object

cdmDatabaseSchema

Schema containing CDM tables

cohortDatabaseSchema

Schema containing cohort tables

targetCohortTable

Name of the target cohort table

targetCohortId

ID of the target cohort

outcomeCohortTable

Name of the outcome cohort table

outcomeCohortId

ID of the outcome cohort (default: 1)

outcomeDateVariable

Date variable for outcome ("cohort_start_date" or "cohort_end_date")

outcomeWashout

Washout period in days (default: Inf for no washout)

minDaysToEvent

Minimum days between cohort entry and outcome event (default: 0)

censorOnCohortExit

Whether to censor at cohort exit (default: FALSE)

censorOnDate

Specific date to censor at (default: NULL)

followUpDays

Maximum follow-up days (default: Inf)

includeAge

Whether to include age_years in the output (default: FALSE)

includeGender

Whether to include gender in the output (default: FALSE)

observationPeriodTable

Name of observation period table (default: "observation_period")

tempEmulationSchema

Schema for temp table emulation (default: NULL)

chunkSize

Optional chunk size for large cohorts (default: NULL)

addDay

Logical; add one day to the outcome date? (default: FALSE)

Value

Data frame with columns subject_id, time, status and optionally age_years and/or gender.


OdysseusSurvivalModule documentation built on April 3, 2026, 5:06 p.m.