Cohort table

Cohort table

A cohort is a set of people that fulfill a certain set of criteria for a period of time.

In omopgenerics we defined the cohort_table class that allows us to represent individuals in a cohort.

A cohort_table is created using the newCohortTable() function that is defined by:

The cohort set and the cohort attrition will be instantiated in the database every time that we create a new cohort table. You can access the cohort set of a cohort_table using the function settings():

settings(cdm$cohort)

You can access the cohort attrition of a cohort_table using the function attrition():

attrition(cdm$cohort)

Cohort attrition table is also used to compute the number of counts that each cohort has. It can be seen with the function cohortCount(). This entirely relies with the cohort attrition attribute and it is not performing any actual calculation.

cohortCount(cdm$cohort)

Each one of the elements that define a cohort table have to fulfill certain criteria.

Cohort Set

A cohort set must be a table with:

Cohort Attrition

A cohort attrition must be a table with:

Cohort Table

A cohort table must be a table with:

Combining generated cohort sets

You can bind two cohort tables using the method bind(). You can combine several cohort tables using this method. The only constrain is that cohort names must be unique across the different cohort tables. You have to provide a name for the new cohort table.

cdm <- bind(cdm$cohort1, cdm$cohort2, cdm$cohort3, name = "my_new_cohort")

cdm$my_new_cohort

settings(cdm$my_new_cohort)

attrition(cdm$my_new_cohort)

cohortCount(cdm$my_new_cohort)

Export metadata about a cohort table

You can export the metadata of a cohort_table using the function: summary():

summary(cdm$cohort)

This will provide a summarised_result object with the metadata of the cohort (cohort set, cohort counts and cohort attrition).