write_hpop_summary_sheet: Write HPOP summary sheet

Description Usage Arguments Value

View source: R/write_hpop_summary_sheet.R

Description

write_hpop_summary_sheet() writes all the content and styling for the HPOP summary sheet. Used within export_hpop_country_summary_xls()

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
write_hpop_summary_sheet(
  df,
  wb,
  sheet_name,
  iso,
  start_year = 2018,
  end_year = 2019:2025,
  value = "value",
  year = "year",
  iso3 = "iso3",
  ind = "ind",
  population = "population",
  transform_value = "transform_value",
  type_col = "type",
  source_col = "source",
  contribution = "contribution",
  contribution_pct = paste0(contribution, "_percent"),
  contribution_pct_total_pop = paste0(contribution, "_percent_total_pop"),
  ind_df,
  ind_ids
)

Arguments

df

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

wb

a openxlsx workbook to be edited.

sheet_name

character name of the sheet to update

iso

ISO3 code of country to summarize.

start_year

Base year for contribution calculation, defaults to 2018.

end_year

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

value

Column name of column with indicator values.

year

Column name of column with years.

iso3

Column name of column with country ISO3 codes.

ind

Column name of column with indicator names.

population

Column name of column with population figures.

transform_value

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

type_col

Column name of column with type data.

source_col

Column name of column to store source information.

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.

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.

ind_df

data frame containing the indicators in the correct order and format to be used.

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.