sampleCohorts {CohortConstructor}R Documentation

Sample a cohort table for a given number of individuals.

Description

sampleCohorts() samples an existing cohort table for a given number of people. All records of these individuals are preserved.

Usage

sampleCohorts(cohort, cohortId = NULL, n, name = tableName(cohort))

Arguments

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.

Value

Cohort table with the specified cohorts sampled.

Examples


library(CohortConstructor)

cdm <- mockCohortConstructor(nPerson = 100)

cdm$cohort2 |> sampleCohorts(cohortId = 1, n = 10)


[Package CohortConstructor version 0.2.1 Index]