specify_ktoe: Converts units from EJ to ktoe

View source: R/specify.R

specify_ktoeR Documentation

Converts units from EJ to ktoe

Description

Primary-final-useful (PFU) data from calc_hmw_pfu() and calc_amw_pfu() are in EJ. This function converts entries in the energy_col from EJ (exajoules) to ktoe and changes the units_col from "EJ" to "ktoe".

Usage

specify_ktoe(
  .df,
  energy_col = MWTools::mw_cols$e_dot,
  units_col = MWTools::mw_cols$unit
)

Arguments

.df

A data frame with units_col and energy_col columns.

energy_col, units_col

See MWTools::mw_constants.

Details

Prior to converting the energy_col from EJ to ktoe, the units_col is verified to contain only "EJ". An error is thrown if any units_col entry is not in EJ.

Value

.df with energy column converted from EJ to ktoe.

Examples

ilo_working_hours_data <- read.csv(file = MWTools::ilo_working_hours_test_data_path())
ilo_employment_data <- read.csv(file = MWTools::ilo_employment_test_data_path())
hmw_data <- prepareRawILOData(ilo_working_hours_data = ilo_working_hours_data,
                              ilo_employment_data = ilo_employment_data)
hmw_data %>%
  calc_hmw_pfu() %>%
  specify_ktoe()

EnergyEconomyDecoupling/MWTools documentation built on April 14, 2025, 9:27 a.m.