remove_suffix_specifications | R Documentation |
Flow
and Product
columns of IEA data frames may have been "specified"
to contain a suffix of the form " [of Natural gas\"], for example.
This function strips away the suffix.
Identification of parenthetical notation delimiters is determined by the notations
argument.
remove_suffix_specifications(
.df,
col,
unsuffixed_col,
notations = list(RCLabels::of_notation, RCLabels::from_notation)
)
.df |
The data frame in which |
col |
The string name of the column in |
unsuffixed_col |
The string name of the column in the output data frame to contain the un-suffixed version of |
notations |
The notations used for row and column names. See |
A version of .df
with suffixes removed from the col
column and the result placed in the despecified_col
column.
library(dplyr)
load_tidy_iea_df() %>%
specify_all() %>%
remove_suffix_specifications(col = "Flow", unsuffixed_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.