Skip to contents

Draws a small multiples type of Pareto Chart grouped by a categorical variable

Usage

draw_pareto_chart_grouped(
  data,
  cat_var,
  grouping_var,
  summarize = FALSE,
  continuous_var,
  drop_na = TRUE,
  highlight_first_n_items = 0,
  lump_last_n_items = 0,
  lumped_cat_name = "Other",
  color = "one",
  scale = "numeric",
  accuracy = 1,
  title_label = "Pareto Chart",
  analysis_desc_label = NULL,
  axis_text_size = 10,
  x_axis_span = "free"
)

Arguments

data

input dataset to be plotted (required)

cat_var

Categorical variable (required)

grouping_var

Grouping variable (required)

summarize

Logical. If FALSE, default, the function expects total counts of each category of the categorical variable. If TRUE, individual values within each category are automatically summed up and ranked. (required)

continuous_var

Continuous variable to rank by (e.g. sum, frequency etc.). Not required if summarize argument is set to TRUE. (required)

drop_na

Logical. If TRUE, default, NA values of the categorical variable are dropped. (required)

highlight_first_n_items

Specify the top n items to be highlighted. By default, it is set to 0. (optional)

lump_last_n_items

Specify the last n items to be lumped into one category. By default, it is set to 0. (optional)

lumped_cat_name

Name lumped category. By default, it is set to "Other". (optional)

color

Set panel fill color for facets. Options are "one" (one color) or "multi" (each panel is a different color). By default, it is set to "one". (optional)

scale

Specify an acceptable argument for scale. Acceptable arguments are "numeric", "percent", "dollar", "dollar-k" or "dollar-M". By default, it is set to "numeric" (optional)

accuracy

Number to round to. Default value is set to 1. If NULL, values will be rounded to the nearest integer. (optional)

title_label

Specify plot title. By default, it is set to display "Pareto Chart" (optional)

analysis_desc_label

Specify plot analysis desc label (subtitle). By default, it is set to display CONTINUOUS VARIABLE COLUMN NAME "by" CATEGORICAL VARIABLE COLUMN NAME (optional)

axis_text_size

Set axis text size. By default, it is set at 10. (optional)

x_axis_span

Set X axis span. Options are "free" (a different span for each panel based on range of values for each panel) and "fixed" (the X axes in all panels are set to span the total range of all values). By default, it is set to "free". (optional)

Value

A 'ggplot' object