despecify_col | R Documentation |
Flow
and Product
columns of IEA data frames may have been "specified"
with one of the functions of specify_all()
.
The specifying makes it difficult to sort the columns in IEA order (with sort_iea_df()
),
as the Flow
and Product
columns now contain non-IEA flows and products.
To enable sorting, this function de-specifies a column in .df
.
despecify_col(
.df,
col,
despecified_col,
notations = list(RCLabels::of_notation, RCLabels::from_notation),
production = IEATools::tpes_flows$production,
resources = IEATools::tpes_flows$resources
)
.df |
The data frame in which |
col |
The string name of the column in |
despecified_col |
The string name of the column in the output data frame to contain the de-specified version of |
notations |
The notations used for row and column names. See |
production , resources |
See |
De-specifying includes the following changes: * Any "Resource" flows are replaced by "Production". E.g., "Resources [of Coal]" becomes "Production". * All parenthetical decorations are removed. E.g., "Other bituminous coal [of Coal mines]" becomes "Other bituminous coal".
Identification of parenthetical notation delimiters is determined by a notation object.
A de-specified version of .df
and the result placed in the despecified_col
column.
library(dplyr)
load_tidy_iea_df() %>%
specify_all() %>%
despecify_col(col = "Flow", despecified_col = "clean_Flow") %>%
select(Flow, Product, Edot, clean_Flow) %>%
filter(endsWith(Flow, RCLabels::bracket_notation[["suff_end"]]))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.