Skip to contents

export_hpop_country_summary_xls Export a country-specific for HPOP billion.

Usage

export_hpop_country_summary_xls(
  df,
  wb,
  iso,
  value_col = "value",
  transform_value_col = "transform_value",
  scenario_col = NULL,
  contribution = "contribution",
  contribution_pct = paste0(contribution, "_percent"),
  contribution_pct_total_pop = paste0(contribution, "_percent_total_pop"),
  default_scenario = "default",
  start_year = 2018,
  end_year = 2019:2025,
  scenario_end_year = end_year,
  sheet_prefix = "HPOP",
  output_folder = "outputs",
  ind_ids = billionaiRe::billion_ind_codes("hpop", include_calculated = TRUE)
)

Arguments

df

Data frame in long format, where 1 row corresponds to a specific country, year, and indicator.

wb

a openxlsx workbook to be edited.

iso

ISO3 code of country to summarize.

value_col

Column name of column with indicator values.

transform_value_col

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

scenario_col

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

contribution

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

contribution_pct

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

contribution_pct_total_pop

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.

default_scenario

name of the default scenario.

start_year

Base year for contribution calculation, defaults to 2018.

end_year

End year(s) for contribution calculation, defaults to 2019 to 2025.

scenario_end_year

End year of the scenarios. Defaults to end_year.

sheet_prefix

Character prefix to add in front of export sheets

output_folder

Folder path to where the Excel files should be written

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

Value

openxslx Workbook object. Output file is in output_folder.