Skip to content

Instantly share code, notes, and snippets.

@seabbs
Created January 7, 2018 13:54
Show Gist options
  • Save seabbs/8cd5f69eb01e63e254238588461e0a36 to your computer and use it in GitHub Desktop.
Save seabbs/8cd5f69eb01e63e254238588461e0a36 to your computer and use it in GitHub Desktop.
Explore TB mortality excluding HIV using getTBinR
# install.packages("getTBinR")
library(getTBinR)
# install.packages("tidyverse")
library(tidyverse)
# Get the data
tb_burden <- get_tb_burden(download_data = TRUE, save = TRUE)
dict <- get_data_dict(download_data = TRUE, save = TRUE)
# Look up variables with mortality in their definition
search_data_dict(def = "mortality")
# Map mortality excluding HIV
map_tb_burden(metric = "e_mort_exc_tbhiv_100k")
# Get countries with highest TB mortality (exc HIV) in the data
high_mortality_countries <- tb_burden %>%
group_by(country) %>%
summarise(e_mort_exc_tbhiv_100k = max(e_mort_exc_tbhiv_100k)) %>%
ungroup %>%
arrange(desc(e_mort_exc_tbhiv_100k)) %>%
slice(1:10) %>%
pull(country) %>%
unique
# Overview of 10 countries with highest TB mortality rates (exc HIV)
plot_tb_burden_overview(metric = "e_mort_exc_tbhiv_100k",
countries = high_mortality_countries)
# Trends over time in mortality rates (exc HIV) by country
plot_tb_burden(metric = "e_mort_exc_tbhiv_100k",
countries = high_mortality_countries,
facet = "country", scales = "free_y")
# Trends over time in incidence rates by country for countries with highest TB mortality (exc HIV)
plot_tb_burden(countries = high_mortality_countries,
facet = "country", scales = "free_y")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment