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(nPerson = 100)
cdm$cohort1 |> subsetCohorts(cohortId = 1)
#> # Source: table<cohort1> [?? x 4]
#> # Database: DuckDB 1.4.0 [unknown@Linux 6.11.0-1018-azure:R 4.5.1/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 1 4 2019-06-09 2019-08-31
#> 2 1 6 1983-03-10 1996-03-21
#> 3 1 7 2013-03-03 2014-09-18
#> 4 1 7 2014-09-19 2014-12-14
#> 5 1 7 2015-04-04 2018-01-18
#> 6 1 8 2013-12-19 2016-08-09
#> 7 1 9 2005-11-05 2005-11-06
#> 8 1 9 2005-11-07 2006-07-18
#> 9 1 9 2006-07-19 2010-07-28
#> 10 1 12 2003-02-09 2007-02-05
#> # ℹ more rows
# }