View source: R/aggregate_erois.R
aggregate_primary_stage_erois | R Documentation |
The function calculates the aggregated primary stage EROIs for each fossil fuel group. It determines the shares of supply of each energy product within each fossil fuel group (by default using the V matrix), selects only the list of energy products defined as primary energy products (see arguments), and from these shares determines the average primary stage EROI by fossil fuel group.
aggregate_primary_stage_erois(
.tidy_erois_df,
.tidy_iea_df,
primary_production_mats = c(IEATools::psut_cols$V),
list_primary_oil_products = IEATools::primary_oil_products,
list_primary_coal_products = IEATools::primary_coal_products,
list_primary_gas_products = IEATools::primary_gas_products,
product.group = "Product.Group",
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,
eroi.method = "Eroi.method",
type = "Type",
boundary = "Boundary",
share = "Share",
eroi = "EROI",
group.eroi = "Group.eroi",
energy.stage = "Energy.stage",
product_without_origin = "product_without_origin",
Group.eroi.inversed = "Group.eroi.inversed",
eroi_calc_method = c("dta", "gma")
)
.tidy_erois_df |
The tidy erois data frame (calculated for each product via input-output) for which the aggregation needs to be done. |
.tidy_iea_df |
The |
primary_production_mats |
The list of matrices to use as primary production matrices to determine the share of supply of each primary energy product.
Default is |
list_primary_oil_products |
The list of primary oil products.
Default is |
list_primary_coal_products |
The list of primary coal products.
Default is |
list_primary_gas_products |
The list of primary gas products.
Default is |
product.group |
The name of the column containing the product group name. Default is "Product.Group". |
country, method, energy_type, last_stage, year, product |
See |
eroi.method |
The name of the column containing the method used for calculating the erois. Default is "Eroi.method". |
type |
The name of the column containing the type of eroi calculated. Default is "Type". |
boundary |
The name of the column containing the boundary for the eroi calculation. Default is "Boundary". |
share |
The name of the column containing the share of each energy product supply within each fossil fuel group. Default is "Share". |
eroi |
The name of the column containing the energy-product level eroi value. Default is "EROI". |
group.eroi |
The name of the column containing the fossil fuel group level eroi value. Default is "Group.eroi". |
energy.stage |
The name of the column containing the energy stage for the calculation of the EROI. Default is "Energy.stage". |
product_without_origin |
The name of the column containing the product name excluding the origin of the product. Default is "product_without_origin". |
Group.eroi.inversed |
Name of the temporary column that computes the inverse of the EROI. |
eroi_calc_method |
The method being used for calculating the erois. Default is "dta". |
The function can work both on a single country Energy Conversion Chain of Domestic Technology Assumption type, or with a multi-regional Energy Conversion Chain for instance using the Global Market Assumption. The input data frame will have to be slightly adapted in this case (for an example see the tests related to the function)
A data frame returning the aggregated primary stage EROIs for each fossil fuel group.
tidy_AB_dta <- ECCTools::tidy_AB_data %>%
IEATools::add_psut_matnames() %>%
ECCTools::transform_to_dta()
tidy_io_AB_dta <- tidy_AB_dta %>%
IEATools::prep_psut() %>%
Recca::calc_io_mats(method_q_calculation = "sum_R_V_cols")
tidy_AB_erois_dta <- tidy_io_AB_dta %>%
Recca::calc_E_EIOU() %>%
Recca::calc_erois() %>%
EROITools::extract_tidy_product_erois() %>%
dplyr::mutate(
Eroi.method = "DTA"
) %>%
dplyr::relocate(tidyselect::all_of("Eroi.method"), .after = tidyselect::all_of("Year"))
res_dta <- aggregate_primary_stage_erois(
.tidy_erois_df = tidy_AB_erois_dta,
.tidy_iea_df = tidy_AB_dta,
eroi_calc_method = "dta"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.