Learn R Programming

sherlock (version 0.7.0)

draw_pareto_chart: Draw Pareto Chart

Description

Draws a Pareto Chart

Usage

draw_pareto_chart(
  data,
  cat_var,
  summarize = FALSE,
  continuous_var,
  drop_na = TRUE,
  highlight_first_n_items = 0,
  lump_last_n_items = 0,
  lumped_cat_name = "Other",
  column_fill = scale_fill_sherlock(3),
  scale = "numeric",
  accuracy = 1,
  title_label = "Pareto Chart",
  analysis_desc_label = NULL,
  axis_text_size = 10
)

Value

A 'ggplot' object

Arguments

data

input dataset to be plotted (required)

cat_var

Categorical 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)

column_fill

Column fill color. By default, it is set to scale_fill_sherlock(3) (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)