This function is used internally by plot_tb_burden
and plot_tb_burden_overview
to prepare data for plotting.
prepare_df_plot(
df = NULL,
dict = NULL,
metric = "e_inc_100k",
conf = NULL,
metric_label = NULL,
countries = NULL,
years = NULL,
compare_to_region = FALSE,
facet = NULL,
annual_change = FALSE,
trans = "identity",
download_data = TRUE,
save = TRUE,
verbose = FALSE,
...
)
Dataframe of TB burden data, as sourced by get_tb_burden
.
If not specified then will source the WHO TB burden data, either locally if available
or directly from the WHO (if download_data = TRUE
).
A tibble of the data dictionary. See get_data_dict
for details. If not supplied the function will attempt to load a saved version of the
dictionary. If this fails and download_data = TRUE
then the dictionary will be downloaded.
Character string specifying the metric to plot
Character vector specifying the name variations to use to specify the upper
and lower confidence intervals. Defaults to NULL
for which no confidence intervals
are used. Used by annual_change
.
Character string specifying the metric label to use.
A character string specifying the countries to target.
Numeric vector of years. Defaults to NULL
which includes all years in the data.
Logical, defaults to FALSE
. If TRUE
all
countries that share a region with those listed in countries
will be plotted.
Note that this will override settings for facet
, unless it is set to "country".
Character string, the name of the variable to facet by.
Logical, defaults to FALSE
. If TRUE
then the
percentage annual change is computed for the specified metric.
A character string specifying the transform to use on the specified metric. Defaults to no
transform ("identity"). Other options include log scaling ("log") and log base 10 scaling
("log10"). For a complete list of options see ggplot2::continous_scale
.
Logical, defaults to TRUE
. If not found locally should the data be
downloaded from the specified URL?
Logical, should the data be saved for reuse during the current R session. Defaults to
TRUE
. If TRUE
then the data is saved to the temporary directory specified by tempdir
.
Logical, defaults to FALSE
. Should additional status and progress messages
be displayed.
Additional arguments to pass to get_tb_burden
.
A list containing 3 elements, the dataframe to plot, the facet to use and the label to assign to the metric axis.
plot_tb_burden plot_tb_burden_overview
# NOT RUN {
prepare_df_plot(countries = "Guinea")
# }
Run the code above in your browser using DataLab