generateCohortSet {CDMConnector}R Documentation

Generate a cohort set on a cdm object

Description

A "cohort_table" object consists of four components

Each of the three attributes are tidy tables. The implementation of this object is experimental and user feedback is welcome.

[Experimental] One key design principle is that cohort_table objects are created once and can persist across analysis execution but should not be modified after creation. While it is possible to modify a cohort_table object doing so will invalidate it and it's attributes may no longer be accurate.

Usage

generateCohortSet(
  cdm,
  cohortSet,
  name,
  computeAttrition = TRUE,
  overwrite = TRUE
)

Arguments

cdm

A cdm reference created by CDMConnector. write_schema must be specified.

cohortSet

A cohortSet dataframe created with readCohortSet()

name

Name of the cohort table to be created. This will also be used as a prefix for the cohort attribute tables. This must be a lowercase character string that starts with a letter and only contains letters, numbers, and underscores.

computeAttrition

Should attrition be computed? TRUE (default) or FALSE

overwrite

Should the cohort table be overwritten if it already exists? TRUE (default) or FALSE

Examples

## Not run: 
library(CDMConnector)
con <- DBI::dbConnect(duckdb::duckdb(), eunomiaDir())
cdm <- cdmFromCon(con,
                  cdmSchema = "main",
                  writeSchema = "main")

cohortSet <- readCohortSet(system.file("cohorts2", package = "CDMConnector"))
cdm <- generateCohortSet(cdm, cohortSet, name = "cohort")

print(cdm$cohort)

attrition(cdm$cohort)
settings(cdm$cohort)
cohortCount(cdm$cohort)

## End(Not run)

[Package CDMConnector version 2.1.1 Index]