Skip to contents

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.

Usage

build_tbl(disease, estimated = NULL, notified = NULL, year = NULL, vars = NULL)

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 to NULL, the function will use the value estimates_table.estimates_field from the notified column in the dxgap_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 to NULL, the function will use the value notifications_table.notifications_field from the notified column in the dxgap_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.

Value

A tibble.

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")
)
}