subsetCohorts()
filters an existing cohort table, keeping only the records
from cohorts that are specified.
Usage
subsetCohorts(cohort, cohortId, name = tableName(cohort))
Examples
# \donttest{
library(CohortConstructor)
cdm <- mockCohortConstructor()
cdm$cohort1 |>
subsetCohorts(cohortId = 1)
#> # A tibble: 63 × 4
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> * <int> <int> <date> <date>
#> 1 1 1 2009-11-23 2009-12-05
#> 2 1 2 1978-05-19 1983-08-31
#> 3 1 4 2015-03-18 2015-07-24
#> 4 1 5 2004-12-22 2005-02-09
#> 5 1 6 1995-02-25 2001-07-26
#> 6 1 7 2017-07-06 2017-07-21
#> 7 1 8 1988-12-19 1991-09-07
#> 8 1 10 2010-02-02 2013-10-12
#> 9 1 11 1992-02-23 2004-01-01
#> 10 1 13 2001-09-07 2006-01-17
#> # ℹ 53 more rows
# }