Skip to contents

Plot % of outcomes as bars

Usage

plot_bars(
  data,
  outcome,
  proportion,
  percentage_labelled,
  achieved,
  total,
  x_axis_title = NULL,
  y_axis_title = "% Patients",
  legend_title = "Outcome",
  bar_fill = "Greys",
  grouping = NULL
)

Arguments

data

A data frame containing outcomes data.

outcome

Variable containing outcomes to be plotted.

proportion

Variable containing proportion of patients who achieved the outcome.

percentage_labelled

Variable containing percentage of patients who achieved the outcome, suffixed with '%' label.

achieved

Variable containing number of patients who achieved the outcome.

total

Variable containing total number of patients.

x_axis_title

Title of the x-axis.

y_axis_title

Title of the y-axis.

legend_title

Title of the legend.

bar_fill

Fill color of the bars.

grouping

Faceting variable.

Value

A bar plot of outcome percentages.

Examples

# \donttest{
if (FALSE) {
library(phdcocktail)
data(ibd_outcomes, package = "phdcocktail")
plot_bars(ibd_outcomes)
  }
# }