To add a new column with the cumulative dose. To add multiple columns use addDrugUtilisation()
for efficiency.
Source: R/addDrugUtilisation.R
addCumulativeDose.Rd
To add a new column with the cumulative dose. To add multiple columns use
addDrugUtilisation()
for efficiency.
Usage
addCumulativeDose(
cohort,
ingredientConceptId,
conceptSet = NULL,
indexDate = "cohort_start_date",
censorDate = "cohort_end_date",
restrictIncident = TRUE,
nameStyle = "cumulative_dose_{concept_name}_{ingredient}",
name = NULL
)
Arguments
- cohort
A cohort_table object.
- ingredientConceptId
Ingredient OMOP concept that we are interested for the study.
- 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.
Examples
# \donttest{
library(DrugUtilisation)
cdm <- mockDrugUtilisation()
cdm$cohort1 |>
addCumulativeDose(ingredientConceptId = 1125315)
#> # Source: table<og_009_1734614220> [?? x 5]
#> # Database: DuckDB v1.1.3 [unknown@Linux 6.8.0-1017-azure:R 4.4.2/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 2 1 2021-10-30 2021-12-02
#> 2 1 2 2019-08-31 2020-11-30
#> 3 1 3 1996-01-16 1999-03-23
#> 4 3 4 2000-06-05 2017-04-08
#> 5 1 5 2016-08-13 2017-03-10
#> 6 1 6 2022-04-20 2022-11-19
#> 7 1 7 2021-04-19 2021-07-08
#> 8 2 8 2020-08-03 2020-10-20
#> 9 3 9 2002-02-22 2002-09-06
#> 10 2 10 2011-06-11 2011-11-13
#> # ℹ 1 more variable:
#> # cumulative_dose_ingredient_1125315_descendants_1125315 <dbl>
# }