fix_OAMR_gw: Fix IEA data for Other non-OECD Americas Gas works plants

View source: R/fixes.R

fix_OAMR_gwR Documentation

Fix IEA data for Other non-OECD Americas Gas works plants

Description

Other Non-OECD Americas has several years (1971–1976) in which Gas works gas is produced but no feedstocks are consumed to create the Gas works gas. This function corrects that problem. In particular, after calling this function, Gas works will consume Natural gas in all years, and Natural gas production is boosted accordingly. The efficiency of World Gas works plants plants in 1971-1976 was used to create the filled data. This function uses data in the IEATools::Fixed_OAMR_gw data frame.

Usage

fix_OAMR_gw(
  .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 Gas works.

Examples

library(dplyr)
example_tidy_iea_df <- load_tidy_iea_df() |> 
  dplyr::filter(Country == "ZAF", Year == 1971) |> 
  dplyr::mutate(
    # Pretend that ZAF is Other non-OECD Americas.
    Country = "OAMR"
  )
example_tidy_iea_df
fixed <- example_tidy_iea_df |> 
  fix_OAMR_gw()
# Compare changed values
example_tidy_iea_df |> 
  dplyr::filter(Flow %in% c("Production",
                            "Gas works"), 
         Product %in% c("Gas works gas", "Natural gas")) |> 
  dplyr::select("Year", "Flow", "Product", "E.dot", "Unit")
fixed %>% 
  dplyr::filter(Flow %in% c("Production",
                            "Gas works"), 
         Product %in% c("Gas works gas", "Natural gas")) |> 
  dplyr::select("Year", "Flow", "Product", "E.dot", "Unit")

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