Skip to contents

Creates stacked (or side-by-side) bar charts visualizing code counts by quality indicators for multiple sets of user-defined thresholds. Each set of thresholds corresponds to a unique plot, which are combined into a multi-panel figure.

Usage

plot_saturation_comp(
  df_all_summary,
  df_qual_summary,
  thresholds_list,
  stacked = TRUE,
  as_proportion = FALSE,
  ncol = 2
)

Arguments

df_all_summary

A data frame containing overall code summary information, including at least the Code column and total_preferred_coder counts.

df_qual_summary

A data frame containing quality indicator counts for each code. Columns should include Code and columns with names ending in _Count representing counts per quality indicator.

thresholds_list

A named list of named lists. Each inner named list specifies minimum count thresholds for each quality indicator. For example:

list(
  Set1 = list(Heterogeniety = 3, `Priority excerpt` = 2),
  Set2 = list(Heterogeniety = 1, `Priority excerpt` = 3)
)

stacked

Logical; if TRUE, bars are stacked. If FALSE, bars are dodged side-by-side.

as_proportion

Logical; if TRUE, plots proportions relative to the total counts per code, otherwise plots raw counts.

ncol

Number of columns to arrange the multiple plots into.

Value

A patchwork object containing combined ggplot2 bar charts, one for each threshold set.

Examples

if (FALSE) { # \dontrun{
thresholds <- list(
  Set1 = list(Heterogeniety = 3, `Priority excerpt` = 2),
  Set2 = list(Heterogeniety = 1, `Priority excerpt` = 3)
)
plot_saturation_comp(df_all_summary, df_qual_summary, thresholds,
stacked = TRUE, as_proportion = FALSE)
} # }