Skip to contents

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

Usage

load_fu_allocation_tables(
  fu_analysis_folder,
  specified_iea_data,
  countries,
  file_suffix = IEATools::fu_analysis_file_info$fu_analysis_file_suffix,
  use_subfolders = TRUE,
  generate_missing_fu_allocation_template = TRUE,
  fu_allocations_tab_name = IEATools::fu_analysis_file_info$fu_allocation_tab_name
)

Arguments

fu_analysis_folder

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

specified_iea_data

A data frame of specified IEA data for countries.

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_allocation_template

Tells whether to generate a missing final-to-useful allocation template from specified_iea_data. Default is TRUE.

fu_allocations_tab_name

The name of the tab for final-to-useful allocations in the Excel file containing final-to-useful allocation data. Default is "FU Allocations".

Value

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

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 final-to-useful allocation data are not available, this function automatically creates an empty final-to-useful allocation template and writes it to disk. Then, this function reads the empty file. This behavior can be modified by setting argument generate_missing_fu_allocation_template to FALSE.