[R] Changing data frame column headings

R. Michael Weylandt michael.weylandt at gmail.com
Wed Dec 5 21:16:44 CET 2012


x <- data.frame(a = 1:5, b = rnorm(5))

names(x) <- LETTERS[2:1]

print(x)

seems to work.

Can you be more explicit about your problem?

Michael

On Wed, Dec 5, 2012 at 6:51 PM, Rich Shepard <rshepard at appl-ecosys.com> wrote:
>   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
> command?
>
> Rich
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> 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