deathCohort: Create cohort based on the death table

View source: R/deathCohort.R

deathCohortR Documentation

Create cohort based on the death table

Description

Create cohort based on the death table

Usage

deathCohort(cdm, name, subsetCohort = NULL, subsetCohortId = NULL)

Arguments

cdm

A cdm reference.

name

Name of the new cohort table created in the cdm object.

subsetCohort

A character refering to a cohort table containing individuals for whom cohorts will be generated. Only individuals in this table will appear in the generated cohort.

subsetCohortId

Optional. Specifies cohort IDs from the subsetCohort table to include. If none are provided, all cohorts from the subsetCohort are included.

Value

A cohort table with a death cohort in cdm

Examples


library(CohortConstructor)

cdm <- mockCohortConstructor(death = TRUE)

# Generate a death cohort
death_cohort <- deathCohort(cdm, name = "death_cohort")
death_cohort

# Create a death cohort for females aged over 50 years old.

# Create a demographics cohort with age range and sex filters
cdm$my_cohort <- demographicsCohort(cdm, "my_cohort", ageRange = c(50,100), sex = "Female")

# Generate a death cohort, restricted to individuals in 'my_cohort'
death_cohort <- deathCohort(cdm, name = "death_cohort", subsetCohort = "my_cohort")
death_cohort |> attrition()



CohortConstructor documentation built on June 8, 2025, 12:49 p.m.