convert_fuel_gasoline_into_motor_gasoline.Rd
This function converts flows of the "Gasoline type jet fuel" product into flows of "Motor gasoline excl. biofuels". The function then gathers those flows into a single new flow. Basically, it aggregates those two products and keeps the "Motor gasoline excl. biofuels" product name.
The .tidy_iea_df
for which jet fuel type gasoline needs to be converted into motor gasoline.
See IEATools::iea_cols
.
A .tidy_iea_df
for which jet fuel type gasoline is converted into motor gasoline.
# Here we add a flow of "Gasoline type jet fuel":
tidy_AB_data %>%
tibble::add_row(
Country = "A",
Method = "PCM",
Energy.type = "E",
Last.stage = "Final",
Year = 2018,
Product = "Gasoline type jet fuel",
Ledger.side = "Consumption",
Flow.aggregation.point = "Industry",
Flow = "Iron and steel",
Unit = "ktoe",
E.dot = 20
) %>%
dplyr::filter(Country == "A" & stringr::str_detect(Product, "(G|g)asoline")) %>%
print()
#> # A tibble: 10 × 11
#> 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 Supply
#> 5 A PCM E Final 2018 Supply
#> 6 A PCM E Final 2018 Supply
#> 7 A PCM E Final 2018 Supply
#> 8 A PCM E Final 2018 Supply
#> 9 A PCM E Final 2018 Supply
#> 10 A PCM E Final 2018 Consumption
#> # ℹ 5 more variables: Flow.aggregation.point <chr>, Flow <chr>, Product <chr>,
#> # Unit <chr>, E.dot <dbl>
# Then we gather both flows:
tidy_AB_data %>%
tibble::add_row(
Country = "A",
Method = "PCM",
Energy.type = "E",
Last.stage = "Final",
Year = 2018,
Product = "Gasoline type jet fuel",
Ledger.side = "Consumption",
Flow.aggregation.point = "Industry",
Flow = "Iron and steel",
Unit = "ktoe",
E.dot = 20
) %>%
dplyr::filter(Country == "A" & stringr::str_detect(Product, "(G|g)asoline")) %>%
convert_fuel_gasoline_into_motor_gasoline() %>%
print()
#> # A tibble: 9 × 11
#> # Groups: Country, Method, Energy.type, Last.stage, Year, Ledger.side,
#> # Flow.aggregation.point, Flow, Product [9]
#> Country Method Energy.type Last.stage Year Ledger.side Flow.aggregation.point
#> <chr> <chr> <chr> <chr> <dbl> <chr> <chr>
#> 1 A PCM E Final 2018 Consumption Industry
#> 2 A PCM E Final 2018 Consumption Other
#> 3 A PCM E Final 2018 Consumption Transport
#> 4 A PCM E Final 2018 Supply Energy industry own u…
#> 5 A PCM E Final 2018 Supply Energy industry own u…
#> 6 A PCM E Final 2018 Supply Energy industry own u…
#> 7 A PCM E Final 2018 Supply Energy industry own u…
#> 8 A PCM E Final 2018 Supply Transformation proces…
#> 9 A PCM E Final 2018 Supply Transformation proces…
#> # ℹ 4 more variables: Flow <chr>, Product <chr>, Unit <chr>, E.dot <dbl>