fix_OAMR_cpp: Fix IEA data for Other non-OECD Americas Charcoal production...

View source: R/fixes.R

fix_OAMR_cppR Documentation

Fix IEA data for Other non-OECD Americas Charcoal production plants

Description

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.

Usage

fix_OAMR_cpp(
  .tidy_iea_df,
  country = IEATools::iea_cols$country,
  year = IEATools::iea_cols$year,
  e_dot = IEATools::iea_cols$e_dot
)

Arguments

.tidy_iea_df

a tidy IEA data frame produced by load_tidy_iea_df()

country, year, e_dot

See IEATools::iea_cols.

Value

.tidy_iea_df with improved Other non-OECD Americas Charcoal production plants.

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
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", "E.dot", "Unit")
fixed %>% 
  dplyr::filter(Flow %in% c("Production",
                            "Charcoal production plants"), 
                Product %in% c("Charcoal", "Primary solid biofuels")) |> 
  dplyr::select("Year", "Flow", "Product", "E.dot", "Unit")

MatthewHeun/IEATools documentation built on Feb. 6, 2024, 3:29 p.m.