R/plots.R
plot_margins_site_age.Rd
Plot the margins (row and column totals) of a computed CHAMPS table
plot_margins_site_age( x, include_text = NULL, include_x_label = TRUE, plot_title = "", reorder_left = TRUE, reorder_right = FALSE, full_separator = "\n" )
x | A computed CHAMPS object that includes a numerator and denominator of counts. |
---|---|
include_text | Whether to include the names "name", percentages "percent", fraction "fraction", names with fraction "full_fraction", or names with percentages "full_percent". Defaults to NULL which is none. |
include_x_label | Whether or not to include x-axis labels. Defaults to TRUE. |
plot_title | is the title to include above the two charts. |
reorder_left | whether to sort the left chart's non-total x values by percent TRUE or not FALSE. Defaults to TRUE |
reorder_right | whether to sort the right chart's non-total x values by percent TRUE or not FALSE. Defaults to FALSE |
full_separator | the text to put between the name and full element. Defaults to a line break. |
specimen_types = c( "Cerebrospinal fluid sample", "Tissue specimen from lung", "Whole blood", "Rectal swab", "Plasma or spun blood specimen") mock_dcd <- calc_cc_allcases_by_site_age(mock, condition = "Streptococcus pneumoniae") mock_tac <- calc_detected_allcases_by_site_age(mock, condition = "Streptococcus pneumoniae", pathogen = "Group B Streptococcus") mock_both <- calc_cc_detected_by_site_age(mock, condition = "Streptococcus agalactiae", pathogen = "Group B Streptococcus", specimen_types = specimen_types) plot_margins_site_age(mock_tac, include_x_label = FALSE, include_text = "full_fraction", plot_title = "TAC Marginal Distributions for Streptococcus pneumoniae") plot_margins_site_age(mock_dcd, include_x_label = TRUE, include_text = "fraction", plot_title = "DeCoDe Marginal Distribution for Streptococcus pneumoniae") plot_margins_site_age(mock_both, include_x_label = FALSE, include_text = "full_fraction", plot_title = "DeCoDe S. pneumoniae where TAC contains S. pneumoniae")