Plot YLL or YLD Associated vs Attributable by Organism
Source:R/prep_daly_plots.R
plot_burden_by_organism.RdProduces a horizontal grouped bar chart showing the top n organisms
ranked by their associated burden (YLL or YLD), with a paired attributable
bar alongside each. Organisms are ranked by the associated value so the
highest-burden pathogen appears at the top.
Usage
plot_burden_by_organism(
data,
metric = c("YLL", "YLD"),
n = 10,
organism_col = NULL,
assoc_col = NULL,
attr_col = NULL,
n_admissions = NULL,
syndrome_col = NULL,
syndrome_name = NULL,
label_digits = 1,
colours = NULL,
base_size = 14,
title = NULL,
subtitle = NULL
)Arguments
- data
Data frame. One row per organism. Must contain the columns named by
organism_col,assoc_col, andattr_col.- metric
Character.
"YLL"or"YLD". Controls default column names, colours, and axis labels. Ignored whenassoc_colandattr_colare supplied explicitly. Default"YLL".- n
Integer. Number of top organisms to display. Default 10.
- organism_col
Character or
NULL. Column containing organism / pathogen names. IfNULL(default), auto-set to"organism_name"for YLL (matchingdaly_calc_yll_*examples) and"pathogen"for YLD (matchingdaly_calc_yld_*defaults).- assoc_col
Character or
NULL. Column for the associated burden value. IfNULL(default), auto-set to"YLL_associated_k"(YLL) or"YLD_associated"(YLD) – matching the output column names ofcompute_yll_associated()andcompute_yld_associated()respectively.- attr_col
Character or
NULL. Column for the attributable burden value. IfNULL(default), auto-set to"YLL_attributable_k"(YLL) or"YLD_attributable"(YLD) – matching the output column names ofcompute_yll_attributable()andcompute_yld_attributable()respectively.- n_admissions
Numeric or
NULL. When supplied, the associated and attributable values are divided byn_admissionsand multiplied by 1 000 before plotting. DefaultNULL(no normalisation; values are plotted in thousands as returned by the YLL/YLD functions).- syndrome_col
Character or
NULL. Column name containing syndrome labels. IfNULL(default), no filtering is applied.- syndrome_name
Character or
NULL. Syndrome value to retain. Requiressyndrome_col. DefaultNULL.- label_digits
Integer. Decimal places in bar value labels. Default 1.
- colours
Named character vector with elements
"associated"and"attributable". IfNULL(default), auto-chosen based onmetric.- base_size
Numeric. Base font size. Default 14.
- title
Character. Custom plot title. Auto-generated if
NULL.- subtitle
Character. Custom subtitle. Auto-generated if
NULL.
Details
The input data should be a pathogen-level summary data frame with
one row per organism, already containing both the associated and attributable
burden columns. For YLD this is typically the output of
compute_yld_associated() left-joined with
compute_yld_attributable(). For YLL it is the
by_pathogen slot of compute_yll_associated() left-joined with
the equivalent slot from compute_yll_attributable().