Skip to contents

[Experimental]

Usage

tableIndication(
  result,
  header = c("group", "strata"),
  splitStrata = TRUE,
  cohortName = TRUE,
  cdmName = TRUE,
  groupColumn = "variable_name",
  type = "gt",
  .options = list()
)

Arguments

result

A summarised_result created by summariseIndication().

header

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

splitStrata

If TRUE strata columns will be split.

cohortName

If TRUE cohort names will be displayed.

cdmName

If TRUE database names will be displayed.

groupColumn

Column to use as group labels.

type

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

.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)

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

result <- cdm$cohort1 |>
  summariseIndication(
    indicationCohortName = "cohort2",
    indicationWindow = list(c(-30, 0)),
    unknownIndicationTable = "condition_occurrence"
  )
#> Getting specified indications
#> Creating indication summary variables
#> Getting unknown indications
#> Summarising indication results

tableIndication(result, type = "tibble")
#> ! Results have not been suppressed.
#> # A tibble: 9 × 6
#>   `Database name` `Variable name`              Indication [header]Cohort name\…¹
#>   <chr>           <chr>                        <chr>      <chr>                 
#> 1 DUS MOCK        Indication from 30 days bef… Cohort 1   0 (0.00 %)            
#> 2 DUS MOCK        Indication from 30 days bef… Cohort 2   0 (0.00 %)            
#> 3 DUS MOCK        Indication from 30 days bef… Cohort 3   0 (0.00 %)            
#> 4 DUS MOCK        Indication from 30 days bef… Cohort 1 … 0 (0.00 %)            
#> 5 DUS MOCK        Indication from 30 days bef… Cohort 1 … 0 (0.00 %)            
#> 6 DUS MOCK        Indication from 30 days bef… Cohort 2 … 0 (0.00 %)            
#> 7 DUS MOCK        Indication from 30 days bef… Cohort 1 … 0 (0.00 %)            
#> 8 DUS MOCK        Indication from 30 days bef… Unknown    1 (16.67 %)           
#> 9 DUS MOCK        Indication from 30 days bef… None       5 (83.33 %)           
#> # ℹ abbreviated name: ¹​`[header]Cohort name\n[header_level]Cohort 2`
#> # ℹ 2 more variables: `[header]Cohort name\n[header_level]Cohort 1` <chr>,
#> #   `[header]Cohort name\n[header_level]Cohort 3` <chr>
# }