
Plots and Tables from an Attributable Fraction Analysis
Source:R/sus_mod_plot_af.R
sus_mod_plot_af.RdProduces bar charts, forest plots, and quantile summaries from a
climasus_af object returned by sus_mod_af(). All visualisation types
follow standard environmental epidemiology burden-of-disease reporting.
Arguments
- fit
A
climasus_afobject produced bysus_mod_af().- type
Character. Plot type:
"bar"(default),"forest", or"quantile".- output_type
Character.
"plot"(default),"table", or"all"(named list$plot,$table,$data).- interactive
Logical.
TRUEconverts the ggplot2 output to an interactive plotly widget. DefaultFALSE.- base_size
Numeric. ggplot2 base font size. Default
12.- save_plot
Character or
NULL. File path to save the plot (PNG/PDF for static; HTML for interactive).- lang
Character. Language for labels:
"pt"(default),"en","es".- verbose
Logical. Print progress messages. Default
FALSE.
Value
Depending on output_type:
"plot"-> aggplotorplotlyobject."table"-> atibbleof the plotted data."all"-> a named list:$plot,$table,$data.
Plot types (type)
type | Description |
"bar" | Grouped bar chart of AF% with CI by component (heat/cold/total) |
"forest" | Horizontal forest plot of AN +/- CI by component |
"quantile" | Bar chart of AF% across exposure quantile bands (requires $by_quantile) |
Examples
if (FALSE) { # \dontrun{
fit <- sus_mod_dlnm(df_dl, outcome_col = "n_obitos")
af <- sus_mod_af(fit)
sus_mod_plot_af(af, type = "bar", lang = "pt")
sus_mod_plot_af(af, type = "forest", lang = "en")
sus_mod_plot_af(af, type = "quantile", lang = "es")
out <- sus_mod_plot_af(af, output_type = "all")
out$table
} # }