add_hep_populations()
adds relevant populations to each HEP Billion indicator
and country, so these can be used to calculate indicator-level aggregations
of the HEP Billion. The column specified by population
will be generated and
filled with relevant populations for that country and indicator. If the column
already exists, only missing values will be replaced by the function.
Usage
add_hep_populations(
df,
population = "population",
pop_year = 2025,
scenario_col = NULL,
transform_value_col = "transform_value",
ind_ids = billion_ind_codes("hep", include_calculated = TRUE)
)
Arguments
- df
Data frame in long format, where 1 row corresponds to a specific country, year, and indicator.
- population
Column name of column to create with population figures.
- pop_year
Year used to pull in HEP populations, defaults to 2025.
- scenario_col
Column name of column with scenario identifiers. Useful for calculating contributions on data in long format rather than wide format.
- transform_value_col
Column name of column(s) with transformed indicator values, used to calculate contributions.
- ind_ids
Named vector of indicator codes for input indicators to the Billion. Although separate indicator codes can be used than the standard, they must be supplied as a named vector where the names correspond to the output of
billion_ind_codes()
.
Details
As HEP indicators where population is relevant are all generated by billionaiRe,
the transform_value_col
is required.
See also
Add populations
add_hpop_populations()
,
add_populations()
,
pop_links
HEP functions
calculate_hep_billion()
,
calculate_hep_components()
,
hep_df
,
transform_hep_data()
,
transform_prev_cmpgn_data()
,
transform_prev_routine_data()