Skip to contents

[Experimental]

Usage

tableDrugUtilisation(
  result,
  header = c("group", "strata"),
  splitStrata = TRUE,
  cohortName = TRUE,
  cdmName = TRUE,
  conceptSet = TRUE,
  ingredient = TRUE,
  groupColumn = NULL,
  type = "gt",
  formatEstimateName = c(`N (%)` = "<count_missing> (<percentage_missing> %)", N =
    "<count>", `Mean (SD)` = "<mean> (<sd>)", `Median (Q25 - Q75)` =
    "<median> (<q25> - <q75>)"),
  .options = list()
)

Arguments

result

A summarised_result object with results from summariseDrugUtilisation().

header

A vector containing which elements should go into the header in order. Allowed are: cdm_name, group, strata, variable, estimate.

splitStrata

If TRUE strata columns will be split.

cohortName

If TRUE cohort names will be displayed.

cdmName

If TRUE database names will be displayed.

conceptSet

If TRUE concept sets name will be displayed.

ingredient

If TRUE ingredients names will be displayed for dose calculation.

groupColumn

Column to use as group labels, these can be: "cdm_name", "cohort_name", "concept_set", "variable_name", and/or "ingredient". If strata is split, any of the levels can be used, otherwise "strata_name" and "strata_level" can be used for table group format.

type

Type of desired formatted table, possibilities: "gt", "flextable", "tibble".

formatEstimateName

Named list of estimate name's to join, sorted by computation order. Indicate estimate_name's between <...>.

.options

Named list with additional formatting options. DrugUtilisation::defaultTableOptions() shows allowed arguments and their default values.

Value

A table with a formatted version of summariseIndication() results.

Examples

# \donttest{

library(DrugUtilisation)
library(CodelistGenerator)

cdm <- mockDrugUtilisation()
#> Warning: ! 6 column in person do not match expected column type:
#>  `gender_concept_id` is numeric but expected integer
#>  `race_concept_id` is numeric but expected integer
#>  `ethnicity_concept_id` is numeric but expected integer
#>  `location_id` is numeric but expected integer
#>  `provider_id` is numeric but expected integer
#>  `care_site_id` is numeric but expected integer
#> Warning: ! 1 column in observation_period do not match expected column type:
#>  `period_type_concept_id` is numeric but expected integer
#> Warning: ! 2 column in visit_occurrence do not match expected column type:
#>  `visit_concept_id` is numeric but expected integer
#>  `visit_type_concept_id` is numeric but expected integer
#> Warning: ! 10 column in condition_occurrence do not match expected column type:
#>  `condition_concept_id` is numeric but expected integer
#>  `condition_type_concept_id` is numeric but expected integer
#>  `condition_status_concept_id` is numeric but expected integer
#>  `stop_reason` is logical but expected character
#>  `provider_id` is logical but expected integer
#>  `visit_occurrence_id` is logical but expected integer
#>  `visit_detail_id` is logical but expected integer
#>  `condition_source_value` is logical but expected character
#>  `condition_source_concept_id` is logical but expected integer
#>  `condition_status_source_value` is logical but expected character
#> Warning: ! 2 column in drug_exposure do not match expected column type:
#>  `drug_concept_id` is numeric but expected integer
#>  `drug_type_concept_id` is numeric but expected integer
#> Warning: ! 2 column in observation do not match expected column type:
#>  `observation_concept_id` is numeric but expected integer
#>  `observation_type_concept_id` is numeric but expected integer
#> Warning: ! 4 column in concept do not match expected column type:
#>  `concept_id` is numeric but expected integer
#>  `valid_start_date` is character but expected date
#>  `valid_end_date` is character but expected date
#>  `invalid_reason` is logical but expected character
#> Warning: ! 2 column in concept_relationship do not match expected column type:
#>  `concept_id_1` is numeric but expected integer
#>  `concept_id_2` is numeric but expected integer
#> Warning: ! 4 column in concept_ancestor do not match expected column type:
#>  `ancestor_concept_id` is numeric but expected integer
#>  `descendant_concept_id` is numeric but expected integer
#>  `min_levels_of_separation` is numeric but expected integer
#>  `max_levels_of_separation` is numeric but expected integer
#> Warning: ! 9 column in drug_strength do not match expected column type:
#>  `drug_concept_id` is numeric but expected integer
#>  `ingredient_concept_id` is numeric but expected integer
#>  `amount_unit_concept_id` is numeric but expected integer
#>  `numerator_unit_concept_id` is numeric but expected integer
#>  `denominator_unit_concept_id` is numeric but expected integer
#>  `box_size` is logical but expected integer
#>  `valid_start_date` is character but expected date
#>  `valid_end_date` is character but expected date
#>  `invalid_reason` is logical but expected character
#> Warning: ! 6 column in person do not match expected column type:
#>  `gender_concept_id` is numeric but expected integer
#>  `race_concept_id` is numeric but expected integer
#>  `ethnicity_concept_id` is numeric but expected integer
#>  `location_id` is numeric but expected integer
#>  `provider_id` is numeric but expected integer
#>  `care_site_id` is numeric but expected integer
#> Warning: ! 1 column in observation_period do not match expected column type:
#>  `period_type_concept_id` is numeric but expected integer
codelist <- CodelistGenerator::getDrugIngredientCodes(cdm, "acetaminophen")
#> Warning: ! `codelist` contains numeric values, they are casted to integers.
cdm <- generateDrugUtilisationCohortSet(cdm, "dus_cohort", codelist)
cdm[["dus_cohort"]] %>%
  summariseDrugUtilisation(ingredientConceptId = 1125315) |>
  tableDrugUtilisation()
#> Warning: ! `codelist` contains numeric values, they are casted to integers.
#> ! Results have not been suppressed.
Database name Variable Unit Estimate name Concept set Ingredient
Cohort name
161_acetaminophen
DUS MOCK number records - N overall overall 7
number subjects - N overall overall 6
number exposures - N (%) ingredient_1125315_descendants overall 0 (0.00 %)
Mean (SD) ingredient_1125315_descendants overall 1.43 (0.79)
Median (Q25 - Q75) ingredient_1125315_descendants overall 1 (1 - 2)
time to exposure - N (%) ingredient_1125315_descendants overall 0 (0.00 %)
Mean (SD) ingredient_1125315_descendants overall 0.00 (0.00)
Median (Q25 - Q75) ingredient_1125315_descendants overall 0 (0 - 0)
cumulative quantity - N (%) ingredient_1125315_descendants overall 0 (0.00 %)
Mean (SD) ingredient_1125315_descendants overall 78.00 (63.69)
Median (Q25 - Q75) ingredient_1125315_descendants overall 80.00 (40.00 - 92.50)
initial quantity - N (%) ingredient_1125315_descendants overall 0 (0.00 %)
Mean (SD) ingredient_1125315_descendants overall 52.29 (38.71)
Median (Q25 - Q75) ingredient_1125315_descendants overall 50.00 (22.50 - 85.00)
number eras - N (%) ingredient_1125315_descendants overall 0 (0.00 %)
Mean (SD) ingredient_1125315_descendants overall 1.00 (0.00)
Median (Q25 - Q75) ingredient_1125315_descendants overall 1 (1 - 1)
exposed time - N (%) ingredient_1125315_descendants overall 0 (0.00 %)
Mean (SD) ingredient_1125315_descendants overall 596.29 (907.59)
Median (Q25 - Q75) ingredient_1125315_descendants overall 371 (52 - 552)
cumulative dose milligram N (%) ingredient_1125315_descendants acetaminophen 0 (0.00 %)
Mean (SD) ingredient_1125315_descendants acetaminophen 285,942.86 (445,839.08)
Median (Q25 - Q75) ingredient_1125315_descendants acetaminophen 40,000.00 (17,500.00 - 455,000.00)
initial daily dose milligram N (%) ingredient_1125315_descendants acetaminophen 0 (0.00 %)
Mean (SD) ingredient_1125315_descendants acetaminophen 641.82 (608.78)
Median (Q25 - Q75) ingredient_1125315_descendants acetaminophen 333.33 (147.48 - 1,215.41)
# }