unionCohorts {CohortConstructor} | R Documentation |
unionCohorts()
combines different cohort entries, with those records
that overlap combined and kept. Cohort entries are when an individual was in
either of the cohorts.
unionCohorts(
cohort,
cohortId = NULL,
gap = 0,
cohortName = NULL,
name = tableName(cohort)
)
cohort |
A cohort table in a cdm reference. |
cohortId |
IDs of the cohorts to include. If NULL all cohorts will be considered. Cohorts not included will be removed from the cohort set. |
gap |
Number of days between two subsequent cohort entries of a subject that will be merged in a single cohort entry |
cohortName |
Name of the returned cohort. If NULL, the cohort name will be created by collapsing the individual cohort names, separated by "_". |
name |
Name of the new cohort table. |
A cohort table.
library(CohortConstructor)
cdm <- mockCohortConstructor(nPerson = 100)
cdm$cohort2 <- cdm$cohort2 |> unionCohorts()
settings(cdm$cohort2)