View source: R/transform_helpers.R
calc_share_imports_by_products | R Documentation |
The function calculates the shares of imports to total consumption by product, for each country and year.
calc_share_imports_by_products(
.tidy_iea_df,
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,
ledger_side = IEATools::iea_cols$ledger_side,
flow_aggregation_point = IEATools::iea_cols$flow_aggregation_point,
year = IEATools::iea_cols$year,
product = IEATools::iea_cols$product,
unit = IEATools::iea_cols$unit,
e_dot = IEATools::iea_cols$e_dot,
imports = IEATools::interface_industries$imports,
matnames = "matnames",
Total_Consumption_By_Product = "Total_Consumption_By_Product",
Share_Imports_By_Product = "Share_Imports_By_Product"
)
.tidy_iea_df |
The |
flow, country, method, energy_type, last_stage, ledger_side, flow_aggregation_point, year, product, unit, e_dot |
See |
imports |
The name of the column containing the quantity (in energy terms) of imported products.
Default is |
matnames |
The column name for matrices names.
Default is |
Total_Consumption_By_Product |
The name of the new column returning total consumption by product. |
Share_Imports_By_Product |
The name of the new column returning the share of imports over total consumption. |
Total consumption is calculated using the calc_total_consumption_by_product()
function.
Note: the function needs to have a column indicating matrix names added first, most likely using the IEATools::add_psut_matnames()
function.
A data frame returning the share of imports over final consumption, for each product.
tidy_AB_data %>%
IEATools::add_psut_matnames() %>%
calc_share_imports_by_products() %>%
print()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.