knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of billionaiRe is to provide an easy interface for using long format data to calculate the World Health Organization's Triple Billions.
You can install billionaiRe from GitHub with:
remotes::install_github("gpw13/billionaiRe", build_vignettes = TRUE)
You will need to have already installed the wppdistro and whdh packages, which is stored in a private repo and only made public upon request from valid WHO users. Please contact messeillere@who.int to request access.
The package is built around a set of functions that calculate the Billions for the three Billions separately:
In the Triple Billions and the billionaiRe package context, scenarios are understood as alternative, plausible, description of how the future may develop based on a set of defined assumptions.
Scenarios must:
Four main sets of scenarios can be identified, from the most basic to the more complex:
scenario_fixed_target()
), follow a specific rate of change (scenario_aroc()
), etc. See Basic scenario for more details.sdg
scenarios)).acceleration
scenarios)If billionaiRe require data that is missing in the scenario, they will be recycled from other scenarios (see Data recycling).
See Scenarios vignette for more details.
add_scenario()
is the entry point function to all other scenario functions. It essentially allow to pass a typical billionaiRe data frame (df
) and apply the selected scenario function.
library(billionaiRe) df <- tibble::tibble( value = 60:80, year = 2010:2030, ind = "pm25", type = "reported", iso3 = "AFG", scenario = "default", source = NA_character_ ) %>% dplyr::mutate(scenario = dplyr::case_when( year > 2021 ~ "historical", TRUE ~ scenario ), type = dplyr::case_when( year > 2021 ~ "projected", TRUE ~ type ))
The choice of scenario function to apply to the df
is done through the scenario_function
parameter. Additional parameters can be passed through the ellipsis (...
).
For instance, to halt the rise to the 2010 value by end_year
(2025 by default), we can apply a simple function to df
. This will apply the halt_rise
function to all unique combination of country and indicator. In this case, there is just one combination:
df %>% add_scenario( scenario_function = "halt_rise", baseline_year = 2010 )
To apply the SDG targets, we use the sdg
:
df %>% add_scenario( scenario_function = "sdg" )
By default, the scenarios start from the last reported or estimated value in the default scenario. This can be bypassed by setting start_scenario_last_default
to FALSE. The scenario will then start at start_year
(2018 by default):
df %>% add_scenario( scenario_function = "sdg", start_scenario_last_default = FALSE )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.