Skip to contents

These help pages document the lower-level API to individually download, read, and tidy data. For a higher-level API that works across all data sets, see:

Usage

download_who(file_name, url_endpoint)

read_who(file_name, data_dir = Sys.getenv("DXGAP_DATADIR"))

tidy_who(data, year = NULL, .shape = "long")

Arguments

file_name

A string containing the name of the file to be read.

url_endpoint

A string indicating the name of the data set to be downloaded. One of the following:

  • budget

  • community

  • estimates

  • expenditure_utilisation

  • labs

  • notifications

data_dir

Path containing the directory to read the data from. Defaults to the path set by the environment variable "DXGAP_DATADIR".

data

A tibble returned from the corresponding read_() function.

year

A year to filter the data by. Defaults to NULL, returning data for all years.

.shape

A string indicating if the data should be in "wide", or "long" format. Defaults to "long".

Value

download_who() returns invisibly the file path in which data are stored.

read_who() returns a tibble containing the data set.

tidy_who() returns s tibble. This is a tidied version of the input tibble.

Details

The data sets currently available from WHO in this package are:

  • notifications

  • estimates

  • budget

  • community

  • expenditures

  • laboratories

  • hbc

Examples

if (FALSE) {
notification <- download_who(
  file_name = paste_dataset_name_date("who", dataset = "notifications", file_ext = ".csv"),
  url_endpoint = "notifications"
)
estimates <- download_who(
  file_name = paste_dataset_name_date("who", dataset = "estimates", file_ext = ".csv"),
  url_endpoint = "estimates"
)
budget <- download_who(
  file_name = paste_dataset_name_date("who", dataset = "budget", file_ext = ".csv"),
  url_endpoint = "budget"
)
community_engagement <- download_who(
  file_name = paste_dataset_name_date("who", dataset = "community", file_ext = ".csv"),
  url_endpoint = "community"
)
expenditure_and_utilisation <- download_who(
  file_name = paste_dataset_name_date("who", dataset = "expenditures", file_ext = ".csv"),
  url_endpoint = "expenditure_utilisation"
)
laboratories <- download_who(
  file_name = paste_dataset_name_date("who", dataset = "laboratories", file_ext = ".csv"),
  url_endpoint = "labs"
)
}
if (FALSE) {
read_who("who_laboratories_2023-08-30.csv")
read_who("who_hbc_2023-07-28.csv")
}
if (FALSE) {
read_who("who_laboratories_2023-08-30.csv") |>
  tidy_who()
}