export_hep_country_summary_xls: Export country summary to Excel for HEP billion$

Description Usage Arguments Value

View source: R/export_country_summary.R

Description

export_hep_country_summary_xls Export a country-specific for HEP billion.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
export_hep_country_summary_xls(
  df,
  wb,
  iso,
  iso3 = "iso3",
  year = "year",
  ind = "ind",
  value = "value",
  transform_value = "transform_value",
  scenario = NULL,
  type_col = "type",
  source_col = "source",
  population = "population",
  contribution = "contribution",
  contribution_pct = paste0(contribution, "_percent"),
  default_scenario = "default",
  start_year = 2018,
  end_year = 2019:2025,
  sheet_prefix = "HEP",
  output_folder = "outputs",
  ind_ids = billionaiRe::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.

wb

a openxlsx workbook to be edited.

iso

ISO3 code of country to summarize.

iso3

Column name of column with country ISO3 codes.

year

Column name of column with years.

ind

Column name of column with indicator names.

value

Column name of column with indicator values.

transform_value

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

scenario

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

type_col

Column name of column with type data.

source_col

Column name of column to store source information.

population

Column name of column with population figures.

contribution

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

contribution_pct

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

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.

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.


ElliottMess/rapporteur documentation built on Jan. 28, 2022, 2:51 a.m.