Re: [R] Change name of a specific column of a data frame

From: jim holtman <jholtman_at_gmail.com>
Date: Tue, 01 Jul 2008 15:28:39 -0400

> x <- data.frame(a=1,b=2,c=3)
> x
  a b c
1 1 2 3
> colnames(x)[2] <- "done"
> x
  a done c
1 1 2 3
>

On Tue, Jul 1, 2008 at 3:17 PM, <naw3_at_duke.edu> wrote:
> Hi,
>
> Sorry for the simple question. Is there a way to change the name of only one
> column of an existing data frame?
>
> I know colnames allows you to set the name of all the columns, but only one
> column in the middle of my data frame needs a new name.
>
> Thanks,
> -Nina
>
> ______________________________________________
> 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.
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

______________________________________________
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.
Received on Tue 01 Jul 2008 - 19:32:04 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 01 Jul 2008 - 20:33:11 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive