Skip to contents

Generate a custom ggplot2 from a summarised_result object generated with summariseTreatment function.

Usage

plotTreatment(
  result,
  facetX = "window_name",
  facetY = c("cdm_name", "cohort_name", "strata"),
  splitStrata = TRUE,
  colour = "treatment"
)

Arguments

result

A summarised_result object with results from summariseDrugRestart().

facetX

Vector of variables to facet by horizontally. Allowed options are: "cdm_name", "cohort_name", "strata", "variable_name"

facetY

Vector of variables to facet by vertically Allowed options are: "cdm_name", "cohort_name", "strata", "variable_name".

splitStrata

Whether to split strata columns.

colour

Vector of variables to distinct by colour. Allowed options are: "cdm_name", "cohort_name", "strata", "variable_name", and "variable_level".

Value

A ggplot2 object.

Examples

if (FALSE) { # \dontrun{
library(DrugUtilisation)

cdm <- mockDrugUtilisation()
result <- cdm$cohort1 |>
  summariseTreatment(
    treatmentCohortName = "cohort2",
    window = list(c(0, 30), c(31, 365))
  )

plotTreatment(result)
} # }