Fix IEA data for Other non-OECD Americas Charcoal production plants
fix_OAMR_cpp.Rd
Other Non-OECD Americas has several years (1971–2010)
in which Charcoal is produced
but no Primary solid biofuels are consumed to
create the Charcoal.
This function corrects that problem.
In particular, after calling this function,
Charcoal production plants
now consume Primary solid biofuels in all years, and
Primary solid biofuels production is boosted accordingly.
The efficiency of Charcoal production plants in 2011
was used to create the filled data.
This function uses data in the IEATools::Fixed_OAMR_cpp
data frame.
Arguments
- .tidy_iea_df
a tidy IEA data frame produced by
load_tidy_iea_df()
- country, year, e_dot
See
IEATools::iea_cols
.
Examples
library(dplyr)
example_tidy_iea_df <- load_tidy_iea_df() |>
dplyr::filter(Country == "GHA") |>
dplyr::mutate(
# Pretend that GHA is Other non-OECD Americas.
Country = "OAMR"
)
example_tidy_iea_df
#> # A tibble: 122 × 11
#> Country Method EnergyType LastStage Year LedgerSide FlowAggregationPoint
#> <chr> <chr> <chr> <chr> <dbl> <chr> <chr>
#> 1 OAMR PCM E Final 1971 Supply Total primary energy su…
#> 2 OAMR PCM E Final 2000 Supply Total primary energy su…
#> 3 OAMR PCM E Final 1971 Supply Total primary energy su…
#> 4 OAMR PCM E Final 2000 Supply Total primary energy su…
#> 5 OAMR PCM E Final 1971 Supply Total primary energy su…
#> 6 OAMR PCM E Final 2000 Supply Total primary energy su…
#> 7 OAMR PCM E Final 2000 Supply Total primary energy su…
#> 8 OAMR PCM E Final 2000 Supply Total primary energy su…
#> 9 OAMR PCM E Final 1971 Supply Total primary energy su…
#> 10 OAMR PCM E Final 2000 Supply Total primary energy su…
#> # ℹ 112 more rows
#> # ℹ 4 more variables: Flow <chr>, Product <chr>, Unit <chr>, Edot <dbl>
fixed <- example_tidy_iea_df |>
fix_OAMR_cpp()
# Compare changed values
example_tidy_iea_df |>
dplyr::filter(Flow %in% c("Production",
"Charcoal production plants"),
Product %in% c("Charcoal", "Primary solid biofuels")) |>
dplyr::select("Year", "Flow", "Product", "Edot", "Unit")
#> # A tibble: 6 × 5
#> Year Flow Product Edot Unit
#> <dbl> <chr> <chr> <dbl> <chr>
#> 1 1971 Production Primary solid biofuels 87400. TJ
#> 2 2000 Production Primary solid biofuels 162909. TJ
#> 3 1971 Charcoal production plants Primary solid biofuels -20000. TJ
#> 4 2000 Charcoal production plants Primary solid biofuels -45804. TJ
#> 5 1971 Charcoal production plants Charcoal 4990. TJ
#> 6 2000 Charcoal production plants Charcoal 21683. TJ
fixed %>%
dplyr::filter(Flow %in% c("Production",
"Charcoal production plants"),
Product %in% c("Charcoal", "Primary solid biofuels")) |>
dplyr::select("Year", "Flow", "Product", "Edot", "Unit")
#> # A tibble: 6 × 5
#> Year Flow Product Edot Unit
#> <dbl> <chr> <chr> <dbl> <chr>
#> 1 1971 Production Primary solid biofuels 11844. TJ
#> 2 2000 Production Primary solid biofuels 10194. TJ
#> 3 1971 Charcoal production plants Primary solid biofuels -237. TJ
#> 4 2000 Charcoal production plants Primary solid biofuels -995. TJ
#> 5 1971 Charcoal production plants Charcoal 154 TJ
#> 6 2000 Charcoal production plants Charcoal 647. TJ