rename_df_columns_with_config: Rename Dataframe Columns With Config

View source: R/rename_df_columns.R

rename_df_columns_with_configR Documentation

Rename Dataframe Columns With Config

Description

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.

Usage

rename_df_columns_with_config(tbl, config)

Arguments

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" ), ) )


Sage-Bionetworks/projectliveModules documentation built on June 26, 2022, 1:11 a.m.