meta_cols | R Documentation |
Determines which columns are metadata columns in an IEA data frame
by subtracting year columns and cols_to_exclude
from all columns names in .df
.
meta_cols(
.df,
not_meta = IEATools::iea_cols$e_dot,
years_to_keep = NULL,
return_names = FALSE
)
.df |
A (possibly) non-tidy data frame with years spread to the right in columns. |
not_meta |
A vector of column names or position integers identifying columns to not
include in the return value.
Default is |
years_to_keep |
A vector of years to retain. Default is |
return_names |
A boolean which tells whether names are returned instead of column indices.
Default is |
A non-tidy data frame will have an e_dot
column, which is not a metadata column.
Thus, the default value for not_meta
is IEATools::iea_cols$e_dot
.
Overriding not_meta
will change the default behavior to exclude different columns.
A vector of string names of metadata columns in .df
.
DF <- data.frame(Edot = 2020, a = c(1, 2), `1967` = c(3, 4), `-42` = c(5, 6), check.names = FALSE)
DF %>% meta_cols()
DF %>% meta_cols(return_names = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.