Skip to contents

Calculates global or regional sums for billions contributions for the UHC, HPOP, and HEP billions.

Usage

calculate_contribution_sums(
  df,
  billion = c("uhc", "hpop", "hep"),
  sum_years,
  sum_type = c("global", "regional"),
  source = sprintf("WHO DDI calculation, %s", format(Sys.Date(), "%B %Y")),
  scenario_col = NULL,
  contribution_col = "contribution"
)

Arguments

df

A data frame

billion

One of uhc, hpop, and hep. The billion for which we want to find global sums.

sum_years

The year(s) for which we want to sum the billions contributions.

sum_type

Allows you to select between global and regional sums.

source

The source for the calculated billions. WHO DDI calculations, with month, year timestamp by default.

scenario_col

Column name of column with scenario identifiers. Useful for calculating contributions on data in long format rather than wide format.

contribution_col

Column name of column(s) to store contribution (population) values.

Value

A data frame with the global sums for the relevant billion. Does not include rows from the original data frame.

Details

full_data is expected to have the values of the billions calculations per country already computed. In this example, we're calculating the global contributions for the HPOP billion for 2025.