Calculate the HPOP Billion using columns of change
Source:R/calculate_hpop_billion.R
calculate_hpop_billion_change.Rd
calculate_hpop_billion_change()
uses the standard HPOP methodology to calculate
the Billions estimates for all end years. It is used within calculate_hpop_billion()
to calculate the Billion and return the data in long format. Called by itself,
it expects a column of changes to be passed in, and
returns the Billion for all end_year
values.
Usage
calculate_hpop_billion_change(
df,
change = "contribution_percent",
contribution_col = "contribution",
population = "population",
end_year = 2019:2025,
pop_year = 2025,
scenario_col = NULL,
ind_ids = billion_ind_codes("hpop")
)
Arguments
- df
Data frame in long format, where 1 row corresponds to a specific country, year, and indicator.
- change
Column name of column(s) with change value
- contribution_col
Column name of column(s) to store contribution (population) values. Must be the same length as
transform_value_col
.- population
Column name of column to create with population figures.
- end_year
End year(s) for contribution calculation, defaults to 2019 to 2025.
- pop_year
Year used to pull in HPOP 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.
- 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()
.