specify_imported_products.Rd
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.
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"
)
The .tidy_iea_df
that needs being specified.
The name of the V matrix.
Default is IEATools::psut_cols$V
.
The name of the Y matrix.
Default is IEATools::psut_cols$Y
.
The name of the U_feed matrix.
Default is IEATools::psut_cols$U_feed
.
The name of the U_eiou matrix.
Default is IEATools::psut_cols$U_eiou
.
The name of the Balancing matrix. Default is "B".
The name of the matrix names column.
Default is IEATools::mat_meta_cols$matnames
.
The string that indicates that the product is of domestic origin in the new origin column. Default is "Domestic".
The string that indicates that the product is of imported origin in the new origin column. Default is "Imported".
The name of the column that specifies the origin of each product.
See IEATools::iea_cols
.
The name of the Exports flows in the .tidy_iea_df
.
Default is IEATools::interface_industries$exports
.
The name of the Imports flows in the .tidy_iea_df
.
Default is IEATools::interface_industries$imports
.
The name of the temporary column that contains the share of imports for each product, by country. Default is "Share_Imports_By_Product".
The name of the temporary column that contains total consumption by product? Default is "Total_Consumption_By_Product".
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.
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.
tidy_AB_data %>%
IEATools::add_psut_matnames() %>%
specify_imported_products() %>%
print()
#> # A tibble: 76 × 13
#> Country Method Energy.type Last.stage Year Ledger.side
#> <chr> <chr> <chr> <chr> <dbl> <chr>
#> 1 A PCM E Final 2018 Consumption
#> 2 A PCM E Final 2018 Consumption
#> 3 A PCM E Final 2018 Consumption
#> 4 A PCM E Final 2018 Consumption
#> 5 A PCM E Final 2018 Consumption
#> 6 A PCM E Final 2018 Consumption
#> 7 A PCM E Final 2018 Consumption
#> 8 A PCM E Final 2018 Consumption
#> 9 A PCM E Final 2018 Consumption
#> 10 A PCM E Final 2018 Consumption
#> # ℹ 66 more rows
#> # ℹ 7 more variables: Flow.aggregation.point <chr>, Flow <chr>, Product <chr>,
#> # Origin <chr>, Unit <chr>, matnames <chr>, E.dot <dbl>