[R] Changing data frame column headings

arun smartpink111 at yahoo.com
Wed Dec 5 21:45:45 CET 2012

I am not sure why ?rename() is not working.
 a <- list(a = 1, b = 2, c = 3)
     rename(a, c(b = "a", c = "b", a="c")) 

----- Original Message -----
From: Rich Shepard <rshepard at appl-ecosys.com>
To: r-help at r-project.org
Sent: Wednesday, December 5, 2012 1:51 PM
Subject: [R] Changing data frame column headings

  I have a reshaped data frame with value column headings concatenated from
two column headings in the melted data frame. I want to change all 56
headings in a single command, but 'names' allows me to change only one at a
time. In Hadley's 2007 article on reshape in the Journal of Statistical
Software he mentions a 'rename' function, but I cannot find that.

  Is there a way to change all data frame column headings in a single


R-help at r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list