View source: R/rename_df_columns.R
rename_df_columns_with_config | R Documentation |
This function will select and rename columns based on the Config. Only columns in the Config will be selected. Columns with a display name, will be renamed that, otherwise stringr::str_to_title will be used on the name.
rename_df_columns_with_config(tbl, config)
tbl |
A tibble data <- dplyr::tribble( ~study, ~month, ~year, "s1", "January", 2001L ) |
config |
A list with a named list named "columns" that has an entry for each column needed in the tibble. Each column must have a "name" field. "display_name" will be used to rename the column. config <- list( "columns" = list( list( "name" = "study", "display_name" = "Consortium" ), list( "name" = "month", "display_name" = "Month" ), ) ) |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.