specify_imported_products: Specifies imported and domestic products

View source: R/transforms_to_gma.R

specify_imported_productsR Documentation

Specifies imported and domestic products

Description

This function specifies imported and domestic products in the Y, U_EIOU, U_feed, and Balancing matrices. For instance, a flow of "Gasoline" will be broken down in two flows: one of imported gasoline, and one of domestic gasoline. The origin is specified in a new column. One of the two flows may be absent, in the case of a product that is not imported, or not domestically produced.

Usage

specify_imported_products(
  .tidy_iea_df,
  V_matrix = IEATools::psut_cols$V,
  Y_matrix = IEATools::psut_cols$Y,
  U_feed_matrix = IEATools::psut_cols$U_feed,
  U_EIOU_matrix = IEATools::psut_cols$U_eiou,
  balancing_matrix = "B",
  matnames = IEATools::mat_meta_cols$matnames,
  domestic = "Domestic",
  imported = "Imported",
  origin = "Origin",
  flow = IEATools::iea_cols$flow,
  country = IEATools::iea_cols$country,
  method = IEATools::iea_cols$method,
  energy_type = IEATools::iea_cols$energy_type,
  last_stage = IEATools::iea_cols$last_stage,
  year = IEATools::iea_cols$year,
  product = IEATools::iea_cols$product,
  unit = IEATools::iea_cols$unit,
  e_dot = IEATools::iea_cols$e_dot,
  exports = IEATools::interface_industries$exports,
  imports = IEATools::interface_industries$imports,
  Share_Imports_By_Product = "Share_Imports_By_Product",
  Total_Consumption_By_Product = "Total_Consumption_By_Product"
)

Arguments

.tidy_iea_df

The .tidy_iea_df that needs being specified.

V_matrix

The name of the V matrix. Default is IEATools::psut_cols$V.

Y_matrix

The name of the Y matrix. Default is IEATools::psut_cols$Y.

U_feed_matrix

The name of the U_feed matrix. Default is IEATools::psut_cols$U_feed.

U_EIOU_matrix

The name of the U_eiou matrix. Default is IEATools::psut_cols$U_eiou.

balancing_matrix

The name of the Balancing matrix. Default is "B".

matnames

The name of the matrix names column. Default is IEATools::mat_meta_cols$matnames.

domestic

The string that indicates that the product is of domestic origin in the new origin column. Default is "Domestic".

imported

The string that indicates that the product is of imported origin in the new origin column. Default is "Imported".

origin

The name of the column that specifies the origin of each product.

flow, country, method, energy_type, last_stage, year, product, unit, e_dot

See IEATools::iea_cols.

exports

The name of the Exports flows in the .tidy_iea_df. Default is IEATools::interface_industries$exports.

imports

The name of the Imports flows in the .tidy_iea_df. Default is IEATools::interface_industries$imports.

Share_Imports_By_Product

The name of the temporary column that contains the share of imports for each product, by country. Default is "Share_Imports_By_Product".

Total_Consumption_By_Product

The name of the temporary column that contains total consumption by product? Default is "Total_Consumption_By_Product".

Details

Only flows belonging to the Y, U_eiou, U_feed, or Balancing matrices are returned. Note that matrices names need to be added first, most likely using the IEATools::add_psut_matnames() function.

Value

A .tidy_iea_df that includes only flows belonging to the Y, U_eiou, U_feed, or Balancing matrices, and for which flows are specified in terms of flows or imported or domestic products.

Examples

tidy_AB_data %>%
IEATools::add_psut_matnames() %>%
specify_imported_products() %>%
print()

earamendia/ECCTools documentation built on May 12, 2023, 2:12 a.m.