Skip to contents

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.

Value

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

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.

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()
#> # A tibble: 12 × 14
#>    Country  Year Method Energy.type Last.stage Unit  R        U        V       
#>    <chr>   <dbl> <chr>  <chr>       <chr>      <chr> <list>   <list>   <list>  
#>  1 CHNM     2000 PCM    E           Final      TJ    <dbl[…]> <dbl[…]> <dbl[…]>
#>  2 CHNM     2000 PCM    E           Useful     TJ    <dbl[…]> <dbl[…]> <dbl[…]>
#>  3 CHNM     2001 PCM    E           Final      TJ    <dbl[…]> <dbl[…]> <dbl[…]>
#>  4 CHNM     2001 PCM    E           Useful     TJ    <dbl[…]> <dbl[…]> <dbl[…]>
#>  5 CHNM     2002 PCM    E           Final      TJ    <dbl[…]> <dbl[…]> <dbl[…]>
#>  6 CHNM     2002 PCM    E           Useful     TJ    <dbl[…]> <dbl[…]> <dbl[…]>
#>  7 GBR      2000 PCM    E           Final      TJ    <dbl[…]> <dbl[…]> <dbl[…]>
#>  8 GBR      2000 PCM    E           Useful     TJ    <dbl[…]> <dbl[…]> <dbl[…]>
#>  9 GBR      2001 PCM    E           Final      TJ    <dbl[…]> <dbl[…]> <dbl[…]>
#> 10 GBR      2001 PCM    E           Useful     TJ    <dbl[…]> <dbl[…]> <dbl[…]>
#> 11 GBR      2002 PCM    E           Final      TJ    <dbl[…]> <dbl[…]> <dbl[…]>
#> 12 GBR      2002 PCM    E           Useful     TJ    <dbl[…]> <dbl[…]> <dbl[…]>
#> # ℹ 5 more variables: Y <list>, S_units <list>, U_feed <list>, U_EIOU <list>,
#> #   r_EIOU <list>