Learn R Programming

DrugUtilisation (version 1.3.1)

addIndication: Add a variable indicating individuals indications

Description

Add a variable to a drug cohort indicating their presence in an indication cohort in a specified time window. If an individual is not in one of the indication cohorts, they will be considered to have an unknown indication if they are present in one of the specified OMOP CDM clinical tables. If they are neither in an indication cohort or a clinical table they will be considered as having no observed indication.

Usage

addIndication(
  cohort,
  indicationCohortName,
  indicationCohortId = NULL,
  indicationWindow = list(c(0, 0)),
  unknownIndicationTable = NULL,
  indexDate = "cohort_start_date",
  censorDate = NULL,
  mutuallyExclusive = TRUE,
  nameStyle = NULL,
  name = NULL,
  restrictIncident = FALSE
)

Value

The original table with a variable added that summarises the individual´s indications.

Arguments

cohort

A cohort_table object.

indicationCohortName

Name of the cohort table containing potential indications.

indicationCohortId

Cohort definition IDs of the indications of interest. If NULL, all cohorts in indicationCohortName are included.

indicationWindow

Time windows over which to identify indications.

unknownIndicationTable

Tables in the OMOP CDM to search for unknown indications.

indexDate

Name of a column that indicates the date to start the analysis.

censorDate

Name of a column that indicates the date to stop the analysis, if NULL end of individuals observation is used.

mutuallyExclusive

Whether intersections should be mutually exclusive. If TRUE, cohort combinations are reported as mutually exclusive categories; if FALSE, each cohort is reported independently.

nameStyle

Name style for the indications. By default: 'indication_{window_name}' (mutuallyExclusive = TRUE), 'indication_{window_name}_{cohort_name}' (mutuallyExclusive = FALSE).

name

Name of the new computed cohort table, if NULL a temporary table will be created.

restrictIncident

Whether to include only target cohort records that start during the analysis period. If FALSE, all target cohort records that overlap with the study period will be included.

Examples

Run this code
# \donttest{
library(DrugUtilisation)
library(dplyr, warn.conflicts = FALSE)
library(CDMConnector)

cdm <- mockDrugUtilisation(source = "duckdb")

indications <- list(headache = 378253, asthma = 317009)
cdm <- generateConceptCohortSet(cdm = cdm,
                                conceptSet = indications,
                                name = "indication_cohorts")

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

cdm$drug_cohort |>
  addIndication(
    indicationCohortName = "indication_cohorts",
    indicationWindow = list(c(0, 0)),
    unknownIndicationTable = "condition_occurrence"
  ) |>
  glimpse()
# }

Run the code above in your browser using DataLab