generateCohortSet {CDMConnector}R Documentation

Generate a cohort set on a cdm object

Description

A "chort_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
)

generate_cohort_set(
  cdm,
  cohort_set,
  name = "cohort",
  compute_attrition = TRUE,
  overwrite = TRUE
)

Arguments

cdm

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

name

Name of the cohort table to be created. This will also be used as a prefix for the cohort attribute tables.

overwrite

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

cohort_set, cohortSet

Can be a cohortSet object created with readCohortSet(), a single Capr cohort definition, or a named list of Capr cohort definitions.

compute_attrition, computeAttrition

Should attrition be computed? TRUE (default) or FALSE

Examples

## Not run: 
library(CDMConnector)
con <- DBI::dbConnect(duckdb::duckdb(), eunomia_dir())
cdm <- cdm_from_con(con,
                    cdm_schema = "main",
                    write_schema = "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 1.3.0 Index]