load_tidy_iea_df | R Documentation |
Loads an IEA extended energy balance data file in .csv
format from disk and converts to a tidy format.
This function bundles several others and relies mostly on default values for arguments:
iea_df()
,
rename_iea_df_cols()
,
clean_iea_whitespace()
,
use_iso_countries()
,
augment_iea_df()
,
specify_non_energy_use()
(optionally),
fix_GHA_industry_electricity() |> fix_GHA_psb() |> fix_COL_electricity_generation()
(optionally),
remove_agg_memo_flows()
, and
tidy_iea_df()
.
load_tidy_iea_df(
.iea_file = sample_iea_data_path(),
unit_val = "TJ",
remove_zeroes = TRUE,
specify_non_energy_flows = FALSE,
apply_fixes = FALSE,
override_df = IEATools::override_iso_codes_df,
country = IEATools::iea_cols$country,
pfu_code = IEATools::country_concordance_cols$pfu_code,
iea_name = IEATools::country_concordance_cols$iea_name
)
.iea_file |
The path of the file to be loaded.
Can be a vector of files to be loaded.
Default loads example data bundled with the package via |
unit_val |
The units for this file. Default is "TJ". |
remove_zeroes |
A logical indicating whether data points with the value |
specify_non_energy_flows |
A logical indicating whether "Non-energy use in xxxxx" Flows
should be specified by "Memo: Non-energy use in < |
apply_fixes |
A logical indicating whether fixes should be applied to IEA data.
Default is |
override_df |
A data frame containing columns |
country |
The name of the country column in the data frames. See |
pfu_code , iea_name |
Names of columns in the override data frame for 3-letter country codes.
These arguments are passed to |
Each bundled function is called in turn using default arguments. See examples for two ways to achieve the same result.
A tidy, augmented data frame of IEA extended energy balance data.
# Check the file first
iea_file_OK(sample_iea_data_path())
# Take a simple approach
simple <- load_tidy_iea_df(specify_non_energy_flows = TRUE)
# Take the complicated approach
complicated <- sample_iea_data_path() |>
iea_df() |>
rename_iea_df_cols() |>
clean_iea_whitespace() |>
remove_agg_memo_flows() |>
use_iso_countries() |>
augment_iea_df() |>
specify_non_energy_use() |>
tidy_iea_df()
# simple and complicated should be exactly the same
all(simple == complicated)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.