calculate_hpop_billion: Calculate HPOP Billion

View source: R/calculate_hpop_billion.R

calculate_hpop_billionR Documentation

Calculate HPOP Billion

Description

calculate_hpop_billion() calculates country-level HPOP Billion based on indicator level changes.

Usage

calculate_hpop_billion(
  df,
  start_year = 2018,
  end_year = 2019:2025,
  pop_year = 2025,
  transform_value_col = "transform_value",
  contribution_col = stringr::str_replace(transform_value_col, "transform_value",
    "contribution"),
  contribution_pct_col = paste0(contribution_col, "_percent"),
  contribution_pct_total_pop_col = paste0(contribution_col, "_percent_total_pop"),
  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.

start_year

Base year for contribution calculation, defaults to 2018.

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.

transform_value_col

Column name of column(s) with transformed indicator values, used to calculate contributions.

contribution_col

Column name of column(s) to store contribution (population) values. Must be the same length as transform_value_col.

contribution_pct_col

Column name of column(s) to store contribution (percent) values. Must be the same length as transform_value_col.

contribution_pct_total_pop_col

Column name of column(s) to store contribution (percent of total population of the country) values. Must be the same length as transform_value_col.

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().

Details

For more details on the HPOP Billion calculation process and how this function ties in with the rest, see the vignette:

vignette("hpop", package = "billionaiRe")

Value

Data frame in long format.

See Also

Other hpop: add_hpop_populations(), calculate_hpop_billion_change(), calculate_hpop_contributions(), hpop_df, transform_hpop_data(), transform_hpop_single(), untransform_hpop_data(), untransform_hpop_single()


gpw13/billionaiRe documentation built on Sept. 27, 2024, 10:05 p.m.