Learn R Programming

DrugUtilisation (version 0.8.3)

generateIngredientCohortSet: Generate a set of drug cohorts based on drug ingredients

Description

Adds a new cohort table to the cdm reference with individuals who have drug exposure records with the specified drug ingredient. Cohort start and end dates will be based on drug record start and end dates, respectively. Records that overlap or have fewer days between them than the specified gap era will be concatenated into a single cohort entry.

Usage

generateIngredientCohortSet(
  cdm,
  name,
  ingredient = NULL,
  gapEra = 1,
  subsetCohort = NULL,
  subsetCohortId = NULL,
  numberExposures = FALSE,
  daysPrescribed = FALSE,
  ...,
  durationRange = lifecycle::deprecated(),
  imputeDuration = lifecycle::deprecated(),
  priorUseWashout = lifecycle::deprecated(),
  priorObservation = lifecycle::deprecated(),
  cohortDateRange = lifecycle::deprecated(),
  limit = lifecycle::deprecated()
)

Value

The function returns the cdm reference provided with the addition of the new cohort table.

Arguments

cdm

A cdm_reference object.

name

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

ingredient

Accepts both vectors and named lists of ingredient names. For a vector input, e.g., c("acetaminophen", "codeine"), it generates a cohort table with descendant concept codes for each ingredient, assigning unique cohort_definition_id. For a named list input, e.g., list( "test_1" = c("simvastatin", "acetaminophen"), "test_2" = "metformin"), it produces a cohort table based on the structure of the input, where each name leads to a combined set of descendant concept codes for the specified ingredients, creating distinct cohort_definition_id for each named group.

gapEra

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

subsetCohort

Cohort table to subset.

subsetCohortId

Cohort id to subset.

numberExposures

Whether to include 'number_exposures' (number of drug exposure records between indexDate and censorDate).

daysPrescribed

Whether to include 'days_prescribed' (number of days prescribed used to create each era).

...

Arguments to be passed to CodelistGenerator::getDrugIngredientCodes().

durationRange

Deprecated.

imputeDuration

Deprecated.

priorUseWashout

Deprecated

priorObservation

Deprecated.

cohortDateRange

Deprecated.

limit

Deprecated.

Examples

Run this code
# \donttest{
library(DrugUtilisation)
library(dplyr)

cdm <- mockDrugUtilisation()

cdm <- generateIngredientCohortSet(
  cdm = cdm,
  ingredient = "acetaminophen",
  name = "acetaminophen"
)

cdm$acetaminophen |>
  glimpse()
# }

Run the code above in your browser using DataLab