plotDrugUtilisation {DrugUtilisation} | R Documentation |
Plot the results of summariseDrugUtilisation
Description
Plot the results of summariseDrugUtilisation
Usage
plotDrugUtilisation(
result,
variable = "number exposures",
plotType = "barplot",
facet = strataColumns(result),
colour = "cohort_name"
)
Arguments
result |
A summarised_result object. |
variable |
Variable to plot. See |
plotType |
Must be a choice between: 'scatterplot', 'barplot', 'densityplot', and 'boxplot'. |
facet |
Columns to facet by. See options with
|
colour |
Columns to color by. See options with
|
Value
A ggplot2 object.
Examples
library(DrugUtilisation)
library(PatientProfiles)
library(dplyr, warn.conflicts = FALSE)
cdm <- mockDrugUtilisation(numberIndividuals = 100)
codes <- list(aceta = c(1125315, 1125360, 2905077, 43135274))
cdm <- generateDrugUtilisationCohortSet(cdm = cdm,
name = "cohort",
conceptSet = codes)
result <- cdm$cohort |>
addSex() |>
summariseDrugUtilisation(
strata = "sex",
ingredientConceptId = 1125315,
estimates = c("min", "q25", "median", "q75", "max", "density")
)
result |>
filter(estimate_name == "median") |>
plotDrugUtilisation(
variable = "days prescribed",
plotType = "barplot"
)
result |>
plotDrugUtilisation(
variable = "days exposed",
facet = cohort_name ~ cdm_name,
colour = "sex",
plotType = "boxplot"
)
result |>
plotDrugUtilisation(
variable = "cumulative dose milligram",
plotType = "densityplot",
facet = "cohort_name",
colour = "sex"
)
mockDisconnect(cdm)
[Package DrugUtilisation version 1.0.4 Index]