addNumberExposures {DrugUtilisation} | R Documentation |
To add a new column with the number of exposures. To add multiple columns use
addDrugUtilisation()
for efficiency.
Description
To add a new column with the number of exposures. To add multiple columns use
addDrugUtilisation()
for efficiency.
Usage
addNumberExposures(
cohort,
conceptSet,
indexDate = "cohort_start_date",
censorDate = "cohort_end_date",
restrictIncident = TRUE,
nameStyle = "number_exposures_{concept_name}",
name = NULL
)
Arguments
cohort |
A cohort_table object. |
conceptSet |
List of concepts to be included. |
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. |
restrictIncident |
Whether to include only incident prescriptions in the analysis. If FALSE all prescriptions that overlap with the study period will be included. |
nameStyle |
Character string to specify the nameStyle of the new columns. |
name |
Name of the new computed cohort table, if NULL a temporary table will be created. |
Value
The same cohort with the added columns.
Examples
library(DrugUtilisation)
library(CodelistGenerator)
library(dplyr, warn.conflicts = FALSE)
cdm <- mockDrugUtilisation()
codelist <- getDrugIngredientCodes(cdm = cdm, name = "acetaminophen")
cdm <- generateDrugUtilisationCohortSet(cdm = cdm,
name = "dus_cohort",
conceptSet = codelist)
cdm$dus_cohort |>
addNumberExposures(conceptSet = codelist) |>
glimpse()
[Package DrugUtilisation version 1.0.4 Index]