Plot YLL or YLD Associated vs Attributable per Hospital
Source:R/prep_daly_plots.R
plot_burden_by_hospital.RdProduces a horizontal grouped bar chart comparing the associated and attributable burden (YLL or YLD) per 1 000 patients across hospitals. Bars are sorted by the associated value (largest at top by default). Each bar is labelled with its rounded value.
Arguments
- data
Data frame. One row per hospital (or one row per hospital x syndrome). Must contain the columns named by
center_col,assoc_col, andattr_col.- metric
Character.
"YLL"or"YLD". Controls which default column names and axis labels are used. Ignored whenassoc_colandattr_colare supplied explicitly. Default"YLL".- center_col
Character. Column containing hospital / centre names. Default
"center_name".- assoc_col
Character or
NULL. Column for the associated per-1 000 value. IfNULL(default), auto-set to"YLL_assoc_per_1000"or"YLD_assoc_per_1000"based onmetric.- attr_col
Character or
NULL. Column for the attributable per-1 000 value. IfNULL(default), auto-set to"YLL_attr_per_1000"or"YLD_attr_per_1000"based onmetric.- syndrome_col
Character or
NULL. Column name containing syndrome labels (e.g."infectious_syndrome"). IfNULL(default), no syndrome filtering is applied.- syndrome_name
Character or
NULL. The syndrome value to retain (e.g."Bloodstream infection"). Requiressyndrome_colto be set. IfNULL(default), all rows are used.- sort_by
Character.
"associated"(default),"attributable", or"none". Controls hospital ordering on the y-axis.- label_digits
Integer. Decimal places in bar value labels. Default 1.
- colours
Named character vector with exactly two elements:
"associated"and"attributable". IfNULL(default), a colour pair is chosen automatically based onmetric(red tones for YLL, blue tones for YLD).- 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 hospital-level summary data frame
(e.g. the output of compute_hospital_daly()) that already contains
the per-1 000 columns. If the summary was computed across multiple
syndromes, use syndrome_col and syndrome_name to restrict
the plot to one syndrome before pivoting.