sampleCohorts {CohortConstructor} | R Documentation |
sampleCohorts()
samples an existing cohort table for a given number of
people. All records of these individuals are preserved.
sampleCohorts(cohort, cohortId = NULL, n, 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 not be sampled. |
n |
Number of people to be sampled for each included cohort. |
name |
Name of the new sampled cohort. |
Cohort table with the specified cohorts sampled.
library(CohortConstructor)
cdm <- mockCohortConstructor(nPerson = 100)
cdm$cohort2 |> sampleCohorts(cohortId = 1, n = 10)