Skip to contents

Generate a plot visualisation (ggplot2) from the output of summariseIndication

Usage

plotIndication(
  result,
  facet = cdm_name + cohort_name ~ window_name,
  colour = "variable_level",
  style = "default"
)

Arguments

result

A summarised_result object.

facet

Columns to facet by. See options with availablePlotColumns(result). Formula is also allowed to specify rows and columns.

colour

Columns to color by. See options with availablePlotColumns(result).

style

Which style to apply to the plot, options are: "default", "darwin" and NULL (default ggplot style). Customised styles can be achieved by modifying the returned ggplot object.

Value

A ggplot2 object

Examples

# \donttest{
library(DrugUtilisation)
library(CDMConnector)

cdm <- mockDrugUtilisation()

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

cdm <- generateIngredientCohortSet(cdm = cdm,
                                   name = "drug_cohort",
                                   ingredient = "acetaminophen")
#>  Subsetting drug_exposure table
#>  Checking whether any record needs to be dropped.
#>  Collapsing overlaping records.
#>  Collapsing records with gapEra = 1 days.

result <- cdm$drug_cohort |>
  summariseIndication(
    indicationCohortName = "indication_cohorts",
    unknownIndicationTable = "condition_occurrence",
    indicationWindow = list(c(-Inf, 0), c(-365, 0))
  )
#>  Intersect with indications table (indication_cohorts)
#>  Summarising indications.

plotIndication(result)
#> Warning: Ignoring empty aesthetic: `width`.

# }