Render templates across multiple years
render_bulk.Rd
render_bulk()
is a convenience wrapper around render_report()
that
allows you to render templates across multiple years.
Usage
render_bulk(
template_name,
disease,
estimated = NULL,
notified = NULL,
year = NULL,
vars = NULL,
override_vars_check = FALSE
)
Arguments
- template_name
String containing the name of the template to render. Run
view_templates()
to see a list of valid options.- disease
A character of length one identifying the disease for which the user wants to build a wide table. The tibble
dxgap_diseases
shows the diseases that are currently supported.- estimated
Override the default
NULL
with a dot-separated character indicating which field from which table should be used as estimated cases for DX Gap computation. If kept toNULL
, the function will use the valueestimates_table.estimates_field
from thenotified
column in thedxgap_diseases
meta table.- notified
Override the default
NULL
with a dot-separated character indicating which field from which table should be used as notified cases for DX Gap computation. If kept toNULL
, the function will use the valuenotifications_table.notifications_field
from thenotified
column in thedxgap_diseases
meta table.- year
An integer vector indicating consecutive years to filter the data on. Defaults to NULL, returning all years present in the data.
- vars
A vector of strings naming columns to subset the data on. Passed to
build_tbl()
. Defaults to NULL, indicating all variables should be used.- override_vars_check
Logical indicating whether to override checks on supported vars. Defaults to FALSE. If TRUE, consistent results are not guaranteed.
Vars Check
This check consists in comparing the character vector of variable names
supplied by the user through the vars
argument, with those that were
selected in light of the exploratory data analysis. If some of the provided
variables are not part of the original subset, the function will throw an
error. However, new variables names can always be added overriding the check
by setting override_vars_check = TRUE
. If a new variable name should be
part of the core subset, it should be added to the dxgap_diseases
tibble.
Examples
if (FALSE) {
tb_vars <- c("year", "is_hbc", "country_code", "dx_gap",
"pop_total", "pop_urban_perc", "pop_density", "gdp", "c_newinc",
"e_inc_num", "e_mort_100k", "culture", "smear", "xpert", "m_wrd")
render_bulk("eda.Rmd", disease = "tb", year = 2018:2021, vars = tb_vars)
}