remove_agg_memo_flows: Remove aggregation and memo rows from data frames of IEA data

View source: R/initialize.R

remove_agg_memo_flowsR Documentation

Remove aggregation and memo rows from data frames of IEA data

Description

Aggregation and memo rows are included with IEA data. Sometimes, it is convenient to remove those rows. This function does so, using default identifying strings for aggregations and memos.

Usage

remove_agg_memo_flows(
  .iea_df,
  flow = IEATools::iea_cols$flow,
  product = IEATools::iea_cols$product,
  agg_flows = IEATools::aggregation_flows,
  memo_flow_prefixes = IEATools::memo_aggregation_flow_prefixes,
  memo_product_prefixes = IEATools::memo_aggregation_product_prefixes
)

Arguments

.iea_df

A data frame of IEA data.

flow

The name of the flow column in iea_df. Default is IEATools::iea_cols$flow.

product

The name of the product columns in iea_df. Default is IEATools::iea_cols$product.

agg_flows

A vector of strings identifying Flows that are aggregations. Default is IEATools::aggregation_flows.

memo_flow_prefixes

A vector of string prefixes for flow memo rows in .iea_df. Default is IEATools::memo_aggregation_flow_prefixes.

memo_product_prefixes

A string prefix for product memo rows in .iea_df. Default is IEATools::memo_aggregation_product_prefixes.

Details

Note that the IEA data sometimes includes a variable number of spaces before the "Memo: " string. There are several places where trailing spaces are found, such as "Nuclear industry ". This function strips all leading and trailing spaces in the Flow and Product columns.

Value

.iea_df without its aggregation rows.

Examples

sample_iea_data_path() %>% 
  iea_df() %>%
  rename_iea_df_cols() %>% 
  remove_agg_memo_flows()

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