Skip to contents

After calling add_psut_matnames(), call this function to add rownames, colnames, rowtypes, and coltypes columns to .tidy_iea_df.

Usage

add_row_col_meta(
  .tidy_iea_df,
  product = IEATools::iea_cols$product,
  flow = IEATools::iea_cols$flow,
  matnames = IEATools::mat_meta_cols$matnames,
  U = IEATools::psut_cols$U,
  U_EIOU = IEATools::psut_cols$U_eiou,
  R = IEATools::psut_cols$R,
  V = IEATools::psut_cols$V,
  Y = IEATools::psut_cols$Y,
  B = IEATools::psut_cols$B,
  industry_type = IEATools::row_col_types$industry,
  product_type = IEATools::row_col_types$product,
  sector_type = IEATools::row_col_types$sector,
  resource_type = IEATools::row_col_types$resource,
  rownames = IEATools::mat_meta_cols$rownames,
  colnames = IEATools::mat_meta_cols$colnames,
  rowtypes = IEATools::mat_meta_cols$rowtypes,
  coltypes = IEATools::mat_meta_cols$coltypes
)

Arguments

.tidy_iea_df

a data frame containing column matnames

flow, product

See IEATools::iea_cols.

matnames

the name of the column in .tidy_iea_df that contains names of matrices (a string). Default is "matnames".

R, U, U_EIOU, V, Y, B

See IEATools::psut_cols.

industry_type, product_type, sector_type, resource_type

See IEATools::row_col_types.

rownames, colnames, rowtypes, coltypes

See IEATools::mat_meta_cols.

Value

.tidy_iea_df with additional columns named rowname, colname, rowtype, and coltype.

Details

If .tidy_iea_df already contains all of rownames, colnames, rowtypes, and coltypes, .tidy_iea_df is returned without modification. If .tidy_iea_df contains some but not all of rownames, colnames, rowtypes, or coltypes, an error is returned.

Examples

library(dplyr)
load_tidy_iea_df() %>% 
  add_psut_matnames() %>%
  add_row_col_meta()
#> # A tibble: 403 × 16
#>    Country Method EnergyType LastStage  Year LedgerSide FlowAggregationPoint    
#>    <chr>   <chr>  <chr>      <chr>     <dbl> <chr>      <chr>                   
#>  1 GHA     PCM    E          Final      1971 Supply     Total primary energy su…
#>  2 GHA     PCM    E          Final      2000 Supply     Total primary energy su…
#>  3 GHA     PCM    E          Final      1971 Supply     Total primary energy su…
#>  4 GHA     PCM    E          Final      2000 Supply     Total primary energy su…
#>  5 GHA     PCM    E          Final      1971 Supply     Total primary energy su…
#>  6 GHA     PCM    E          Final      2000 Supply     Total primary energy su…
#>  7 GHA     PCM    E          Final      2000 Supply     Total primary energy su…
#>  8 GHA     PCM    E          Final      2000 Supply     Total primary energy su…
#>  9 GHA     PCM    E          Final      1971 Supply     Total primary energy su…
#> 10 GHA     PCM    E          Final      2000 Supply     Total primary energy su…
#> # ℹ 393 more rows
#> # ℹ 9 more variables: Flow <chr>, Product <chr>, Unit <chr>, Edot <dbl>,
#> #   matnames <chr>, rownames <chr>, colnames <chr>, rowtypes <chr>,
#> #   coltypes <chr>