calc_U_feed_U_eiou_r_eiou: Calculate U_feed, U_eiou, and r_eiou columns from a U matrix

View source: R/psut.R

calc_U_feed_U_eiou_r_eiouR Documentation

Calculate U_feed, U_eiou, and r_eiou columns from a U matrix

Description

U_feed, U_eiou, and r_eiou matrices are calculated from U. All three matrices (U_feed, U_eiou, and r_eiou) have the same structure (row names, column names, row types, and column types) as U. For MWTools, there is no energy industry own use (EIOU), so U_feed is simply a copy of U, and U_eiou and r_eiou are full of 0s.

Usage

calc_U_feed_U_eiou_r_eiou(
  .df = NULL,
  U = MWTools::psut_cols$U,
  U_feed = MWTools::psut_cols$U_feed,
  U_eiou = MWTools::psut_cols$U_eiou,
  r_eiou = MWTools::psut_cols$r_eiou
)

Arguments

.df

A PSUT data frame containing a column of U matrices. Default is NULL, allowing a single matrix for the U argument.

U

The name of the incoming U matrix. See MWTools::psut_cols.

U_feed, U_eiou, r_eiou

Names for outgoing matrices. See MWTools::psut_cols.

Details

This function employs matsindf::matsindf_apply() internally, so U can be either a single matrix or the name of the U column in .df.

Value

.df with new columns for U_feed, U_eiou, and r_eiou matrices.

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_df <- hmw_data %>%
  calc_hmw_pfu() %>%
  # Keep only a few years for speed.
  dplyr::filter(Year %in% 2000:2002)
amw_df <- amw_test_data_path() %>%
  read.csv() %>%
  calc_amw_pfu() %>%
  # Keep only a few years for speed.
  dplyr::filter(Year %in% 2000:2002)
specify_energy_type_method(hmw_df, amw_df) %>%
  specify_product() %>%
  specify_TJ() %>%
  MWTools::specify_primary_production() %>%
  specify_useful_products() %>%
  specify_fu_machines() %>%
  specify_last_stages() %>%
  MWTools::add_row_col_meta() %>%
  MWTools::collapse_to_psut() %>%
  calc_S_units() %>%
  calc_U_feed_U_eiou_r_eiou()

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