rename: Change the name of a data.frame column

View source: R/utils.R

renameR Documentation

Change the name of a data.frame column

Description

Simple function to rename a column in a data.frame The rename is done "in place", no need to reassign the data.frame A message is printed to confirm the change

Usage

rename(data, oldname, newname)

Arguments

data

A data frame passed to the function

oldname

Name of the column/variable to rename

newname

New name to apply

Details

Data.frame and column names are passed to the function as symbols (without "")

Value

Nothing, the passed data.frame is modified directly

Examples

df <- as.data.frame( c(One=1,Two=2) )
rename(df,Two,Last)

Epiconcept-Paris/STRAP-epiuf documentation built on Aug. 5, 2024, 3:41 a.m.