generate_eta_fu_template: Create a final-to-useful efficiencies template

View source: R/template_functions.R

generate_eta_fu_templateR Documentation

Create a final-to-useful efficiencies template

Description

The only arguments used internally are country, fu_allocation_table_path, fu_allocation_tab_namek eta_fu_template_file_name overwrite, and output_path, allowing the caller to specify only output_path to override all of the path information stored in the drake cache.

Usage

generate_eta_fu_template(
  country,
  country_col = IEATools::iea_cols$country,
  cache_path = PFUWorkflow::cache_info$cache_path,
  fu_analysis_path_target = PFUWorkflow::target_names$fu_analysis_folder,
  fu_allocation_table_file_name = paste0(country,
    IEATools::fu_analysis_file_info$fu_analysis_file_suffix),
  ext = ".xlsx",
  fu_allocation_table_path = file.path(drake::readd(fu_analysis_path_target,
    character_only = TRUE, path = cache_path), country) %>%
    dir_create_pipe(showWarnings = FALSE, recursive = TRUE) %>%
    file.path(fu_allocation_table_file_name),
  fu_allocation_tab_name = IEATools::fu_analysis_file_info$fu_allocation_tab_name,
  eta_fu_template_file_name = paste0(country, " FU etas Template"),
  output_path = file.path(drake::readd(fu_analysis_path_target, character_only = TRUE,
    path = cache_path), country) %>% dir_create_pipe(showWarnings = FALSE, recursive =
    TRUE) %>% file.path(paste0(eta_fu_template_file_name, ext)),
  overwrite = FALSE
)

Arguments

country

A string of the 3-letter ISO country code

country_col

A string containing the name of the country column in the final-to-useful allocation table. Default is IEATools::iea_cols$country.

cache_path

See PFUWorkflow::cache_info.

fu_analysis_path_target

See PFUWorkflow::target_names.

fu_allocation_table_file_name

The name of the file containing the final-to-useful allocations for country. Default is "country FU Analysis.ext".

ext

The file name extension for both the allocation table and the efficiency template. Default is ".xlsx" for an Excel file.

fu_allocation_table_path

The path the the

fu_allocation_tab_name

The name of the tab containing final-to-useful allocation information in fu_analysis_file_name. Default is "FU Allocations".

eta_fu_template_file_name

The name of the efficiency template file written by this function. Default is "country FU etas Template.ext".

output_path

The path to the output file. Default is constructed from the drake cache (fu_analysis_path_target) and country, and eta_fu_template_file_name arguments.

overwrite

Tells whether to overwrite an existing file named eta_fu_template_file_name.ext in location fu_analysis_path_name. Default is FALSE.

Value

the path to the blank final-to-useful efficiency template


MatthewHeun/SEAPSUTWorkflow documentation built on April 22, 2022, 2:21 p.m.