convert_column_names: Convert values in a vector to their cooresponding values...

View source: R/convert_column_names.R

convert_column_namesR Documentation

Convert values in a vector to their cooresponding values according to a data frame

Description

Convert values in a vector to their cooresponding values according to a data frame

Usage

convert_column_names(names_vector, names_map)

Arguments

names_vector

The column names of a data frame. i.e. the character vector returned from calling 'names()' on a data frame.

names_map

A data frame with 2 columns:

  • names: the name of the column in the code

  • display_names: the column name to display to the user

Value

The names where every old name in names is replaced with its cooresponding display name

Examples

names_vector <- c("lot_location_code", "location_name", "actions")
names_map <- data.frame(
               names = c("location_name", "lot_location_code"),
               display_names = c("Location Name", "Lot Location Code"),
               stringsAsFactors = FALSE
               )
convert_column_names(names_vector, names_map)


Tychobra/tychobratools documentation built on April 12, 2022, 12:29 a.m.