Get WHO Tuberculosis Data

Facilitates easy import of analysis ready World Health Organisation Tuberculosis data and provides plotting functions for exploratory data analysis.


Project Status: Active – The project has reached a stable, usable state and is being actively developed. CRAN_Status_Badge Travis-CI Build Status AppVeyor Build Status Coverage Status metacran downloads

Quickly and easily import analysis ready TB burden data, from the World Health Orgnaisation (WHO), into R. The aim of the package is to speed up access to high quality TB burden data, using a simple R interface. Generic plotting functions are provided to allow for rapid graphical exploration of the WHO TB data. A shiny dashboard is built in to showcase package functionality. This package is inspired by a blog post, which looked at WHO TB incidence rates. See here for the WHO data permissions. For help getting started see the Getting Started vignette and for a case study using the package see the Exploring Global Trends in Tuberculosis Incidence Rates vignette.

Installation

Install the CRAN version:

install.packages("getTBinR")

Alternatively install the development version from GitHub:

devtools::install_github("seabbs/getTBinR")

Quick start

Lets get started quickly by mapping and then plotting TB incidence rates in the United Kingdom. First map global TB incidence rates in 2016 (this will also download and save both the TB burden data and its data dictionary, if they are not found locally, to R's temporary directory),

getTBinR::map_tb_burden(metric = "e_inc_100k",
                        year = 2016)
#> Downloading data from: https://extranet.who.int/tme/generateCSV.asp?ds=estimates
#> Saving data to: /tmp/Rtmp4KazJO/TB_burden.rds
#> Downloading data from: https://extranet.who.int/tme/generateCSV.asp?ds=dictionary
#> Saving data to: /tmp/Rtmp4KazJO/TB_data_dict.rds
#> 1 results found for your variable search for e_inc_100k

Then compare TB incidence rates in the UK to TB incidence rates in other countries in the region,

getTBinR::plot_tb_burden_overview(metric = "e_inc_100k",
                                  countries = "United Kingdom",
                                  compare_to_region = TRUE,
                                  interactive = FALSE)
#> Loading data from: /tmp/Rtmp4KazJO/TB_burden.rds
#> Loading data from: /tmp/Rtmp4KazJO/TB_data_dict.rds
#> 1 results found for your variable search for e_inc_100k

In order to compare the changes in incidence rates over time, in the region, plot the annual percentage change (note that this functionality is currently only available in the development version of the package),

getTBinR::plot_tb_burden_overview(metric = "e_inc_100k",
                                  countries = "United Kingdom",
                                  compare_to_region = TRUE,
                                  annual_change = TRUE,
                                  interactive = FALSE)
#> Loading data from: /tmp/Rtmp4KazJO/TB_burden.rds
#> Loading data from: /tmp/Rtmp4KazJO/TB_data_dict.rds
#> 1 results found for your variable search for e_inc_100k
#> Warning: Removed 16 rows containing missing values (geom_point).

Finally plot TB incidence rates over time in the United Kingdom.

getTBinR::plot_tb_burden(metric = "e_inc_100k",
                         countries = "United Kingdom",
                         facet = "country",
                         interactive = FALSE)
#> Loading data from: /tmp/Rtmp4KazJO/TB_burden.rds
#> Loading data from: /tmp/Rtmp4KazJO/TB_data_dict.rds
#> 1 results found for your variable search for e_inc_100k

See Functions for more details of the functions used (note the fuzzy country matching, map_tb_burden, plot_tb_burden_overview and plot_tb_burden will try to exactly match your country request and if that fails will search for partial matches) and for more package functionality. We could make these plots interactive by specifying interactive = TRUE

Shiny Dashboard

To explore the package functionality in an interactive session, or to investigate TB without having to code extensively in R, a shiny dashboard has been built into the package. This can either be used locally using,

getTBinR::run_tb_dashboard()

Or accessed online. Any metric in the WHO data can be explored, with country selection using the built in map, and animation possible by year.

Additional Functionality

File an issue here if there is a feature, or a dataset, that you think is missing from the package, or better yet submit a pull request!

Docker

This package has been developed in docker based on the rocker/tidyverse image, to access the development environment enter the following at the command line (with an active docker daemon running),

docker pull seabbs/gettbinr
docker run -d -p 8787:8787 -e USER=getTBinR -e PASSWORD=getTBinR --name getTBinR seabbs/gettbinr

The rstudio client can be accessed on port 8787 at localhost (or your machines ip). The default username is getTBinR and the default password is getTBinR.

News

getTBinR 0.5.1.0

Feature updates

  • Added annual_change arguement to all plotting/mapping functions. Passed to prepare_df_plot. Returns the percentage annual change for the supplied metric.
  • Added trans arguement to all plotting functions to allow scaling using any ggplot2::continous_scale trans arguement.
  • Added adaptive axis and legend labels to properly show annual percentage change.
  • Added run_tb_dashboard to launch a shiny dashboard for exploring global tuberculosis
  • Changed function defaults so that data is automatically downloaded and saved into the temporary directory when get_data functions are called.

Package updates

  • Added new examples to display new functionality
  • Updated readme with new functionality
  • Updated intro vignette with new functionality
  • Added a new case studies vignette section
  • Added a case study exploring global trends in Tuberculosis incidence rates
  • Added a work around using utils::read.csv for downloading the data when fread::data.table fails. Related to this issue.

getTBinR 0.5.0.0

Feature updates

  • Added download_data arguement to all functions to make downloading data explicit.
  • Added save arguement to all functions to make saving the data explicit.
  • Added save_name and path arguements to all functions to make location of saving explicit.

Package updates

  • Updated documentation to reflect above changes.
  • Updated tests to reflect changes.
  • Doc improvements ready for CRAN.
  • Switched Imported packages from github versions to CRAN versions.
  • Switched to saving data only to temporary directory (tempdir())

getTBinR 0.1.0.0

Feature updates

  • Added map_tb_burden function to map TB metrics.

Package updates

  • Added a NEWS.md file to track changes to the package.

getTBinR 0.0.5.0

Feature updates

  • Added plot_tb_burden_overview function to plot an overview of the TB burden.

Package updates

  • Updated the package site.
  • Refactored plotting code.

getTBinR 0.0.1.0

Feature updates

  • Added plot_tb_burden function to plot TB burden

Package updates

  • Set up package infractstructure

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("getTBinR")

0.5.4 by Sam Abbott, 4 days ago


http://www.samabbott.co.uk/getTBinR, https://github.com/seabbs/getTBinR


Report a bug at https://github.com/seabbs/getTBinR/issues


Browse source code at https://github.com/cran/getTBinR


Authors: Sam Abbott [aut, cre] (<https://orcid.org/0000-0001-8057-8037>)


Documentation:   PDF Manual  


GPL-3 | file LICENSE license


Imports data.table, tibble, dplyr, tidyr, purrr, ggplot2, magrittr, plotly, ggthemes, viridis, scales

Suggests devtools, testthat, vdiffr, covr, pkgnet, rmarkdown, knitr, tidyverse, shiny, shinydashboard, shinyWidgets, shinycssloaders


See at CRAN