ggAttrition: Visualise attrition data as a barplot

Description Usage Arguments Examples

View source: R/ggAttrition.R

Description

Visualise attrition data as a barplot

Usage

1
2
3
4
5
ggAttrition(data, label, n, sort = NULL, show_p = TRUE, N_max = NULL,
  bar_fill = NULL, bar_col = "black", bar_alpha = 0.9,
  label_pos = "b", label_thresh = 0.7, title_pos = "m",
  wrap_width = 100, flip = TRUE, nudge_title = 10,
  nudge_lab = NULL)

Arguments

data

dataframe.

label

Unquoted name of column indicating selection criteria

n

Unquoted name of column indicating cohort size

sort

Either NULL (no sorting), 'a' for ascending, or 'd' for descending

show_p

logical. Should percentages be included?

N_max

numeric. Maximum value used in calculating percentages. Defaults to the maximum value observed in the data.

bar_fill

character. Optional bar fill and border color

bar_col

character. Optional bar border color

bar_alpha

numeric. Alpha of bar

label_pos

character. Position of labels, either "b", "m", or "l"

title_pos

character. Position of title, either "m" for margins, or "l" for left side of plot

wrap_width

integer. Optional integer indicating how much to wrap selection criteria text

flip

logical. Should axes be flipped?

nudge_title

numeric. Nudging of title

nudge_lab

numeric. Nudging of label

type

character. Type of plot. Currently must be 'bar'

label_pos

character. Position of labels, either "t" for top, or "b" for bottom.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
 library(tidyverse)

 data <- tibble("criteria" = c("Start",
                               "Criteria A ....",
                               "Criteria B ....",
                               "Criteria C ....",
                               "Criteria D ...."),
                "size" = c(1000, 785, 456, 234, 154))


ggAttrition(data, criteria, size) +
  labs(title = "Attrition Table")

epijim/PharmaPlots documentation built on Nov. 4, 2019, 11:54 a.m.