renamer: Renaming dataframe columns

View source: R/renamer.R

renamerR Documentation

Renaming dataframe columns

Description

a wrapper function for renaming functions in plyr package

Usage

renamer(data, from, to, warn_missing = TRUE)

Arguments

data

a dataframe or a vector

from

names in data to be changed from

to

names to changed to

warn_missing

TRUE/FALSE whether a warning message will be returned if the from values not present in data

Examples

l <- "first"
k <- "second"
renamer(names(iris), from = "Species", to = "k")
renamer(names(iris), from = c("Species", "Sepal.Length"), to = c("hey", "tyfg"))
renamer(names(iris), from = names(iris)[1], to = c("hey"))
renamer(names(iris), from = 1, to = "k")
renamer(names(iris), from = 1, to = l)
renamer(names(iris), from = "Species", to = k)
renamer(names(iris), from = "Specis", to = k)

renamer(iris, from = "Species", to = "k")
renamer(iris, from = c("Species", "Sepal.Length"), to = c("hey", "tyfg"))
renamer(iris, from = names(iris)[1], to = c("hey"))
renamer(iris, from = 1, to = "k")
renamer(iris, from = 1, to = l)
renamer(iris, from = "Species", to = k)
renamer(iris, from = "Specis", to = k)

IbrahimHE/wrangler documentation built on March 27, 2022, 4:23 p.m.