load_eta_fu_tables: Load FU efficiency tables

View source: R/table_functions.R

load_eta_fu_tablesR Documentation

Load FU efficiency tables

Description

This function reads all final-to-useful efficiency data in files in the fu_analysis_folder that start with the country prefixes given in countries.

Usage

load_eta_fu_tables(
  fu_analysis_folder,
  completed_fu_allocation_tables,
  tidy_specified_iea_data,
  countries,
  file_suffix = IEATools::fu_analysis_file_info$fu_analysis_file_suffix,
  use_subfolders = TRUE,
  generate_missing_fu_etas_template = TRUE,
  eta_fu_tab_name = IEATools::fu_analysis_file_info$eta_fu_tab_name
)

Arguments

fu_analysis_folder

The folder from which final-to-useful analyses will be loaded.

completed_fu_allocation_tables

A data frame of completed final-to-useful allocation tables for countries used to generate an FU efficiency template on the fly, if needed and if generate_missing_fu_etas_template is TRUE.

tidy_specified_iea_data

A data frame of tidy and specified IEA data that are used to make a blank eta_fu template, if needed. Note that this argument needs to be specified only when the eta_fu template is unavailable.

countries

The countries for which allocation tables should be loaded.

file_suffix

The suffix for the FU analysis files. Default is " FU Analysis.xlsx".

use_subfolders

Tells whether to look for files in subfolders named by countries. Default is TRUE.

generate_missing_fu_etas_template

Tells whether to create a template for final-to-useful efficiencies. Default is TRUE.

eta_fu_tab_name

See IEATools::fu_analysis_file_info.

Details

By default, it is assumed that each country's final-to-useful analysis file will be in a subfolder of fu_analysis_path. Set use_subfolders to FALSE to change the default behavior.

If the file from which final-to-useful efficiencies are to be read does not exist, an error is thrown.

If the file from which final-to-useful efficiencies are to be read exists but no tab named eta_fu_tab_name exists, a blank template will be generated and saved into the file.

Value

A data frame of FU efficiency tables read by IEATools::load_eta_fu_data(). If no FU Efficiency data are found and generate_missing_fu_etas_template is TRUE, an empty template written to disk and the empty template is returned. If no FU Efficiency data are found and generate_missing_fu_etas_template is FALSE, NULL is returned.


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