Load all data for a disease into a single wide table
build_tbl.Rd
build_tbl()
loads all files for a given disease into a single dataframe. It
does this by flattening all of the tables into a single wide table by
performing a series of cascading joins on matching keys.
Arguments
- 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. Defaults to NULL, indicating all variables should be used.
Examples
if (FALSE) {
build_tbl(
"tb",
year = 2019,
estimated = "who_estimates.e_inc_num",
notified = "who_notifications.c_newinc",
c("year", "country_code", "pop_density", "e_inc_num", "c_newinc")
)
build_tbl(
"tb",
year = 2019:2018,
estimated = "who_estimates.e_inc_num",
notified = "who_notifications.c_newinc",
c("year", "country_code", "pop_density", "e_inc_num", "c_newinc")
)
}