Learn R Programming

DrugUtilisation (version 1.0.1)

erafyCohort: Erafy a cohort_table collapsing records separated gapEra days or less.

Description

Erafy a cohort_table collapsing records separated gapEra days or less.

Usage

erafyCohort(
  cohort,
  gapEra,
  cohortId = NULL,
  nameStyle = "{cohort_name}_{gap_era}",
  name = omopgenerics::tableName(cohort)
)

Value

A cohort_table object.

Arguments

cohort

A cohort_table object.

gapEra

Number of days between two continuous exposures to be considered in the same era.

cohortId

A cohort definition id to restrict by. If NULL, all cohorts will be included.

nameStyle

String to create the new names of cohorts. Must contain '{cohort_name}' if more than one cohort is present and '{gap_era}' if more than one gapEra is provided.

name

Name of the new cohort table, it must be a length 1 character vector.

Examples

Run this code
# \donttest{
cdm <- mockDrugUtilisation()

cdm$cohort2 <- cdm$cohort1 |>
  erafyCohort(gapEra = 30, name = "cohort2")

cdm$cohort2

settings(cdm$cohort2)

mockDisconnect(cdm)
# }

Run the code above in your browser using DataLab