Hi eric, Try
colnames(x) colnames(x)[1] <- 'newname' colnames(x) HTH, Jorge On Sun, Jan 16, 2011 at 11:28 PM, eric <> wrote: > > How do I change the name of one column in a data frame ? Suppose I have a > data frame x with 5 columns. If the names were date, col1, col2, col3, col4 > and I wanted to simply change the name of date, what would the command be ? > I tried the following and it didn't seem to work : > > names(x[1]) <- "newname" > > Thanks in advance for the comments > -- > View this message in context: > http://r.789695.n4.nabble.com/data-frame-column-name-change-tp3220684p3220684.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@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. > [[alternative HTML version deleted]] ______________________________________________ R-help@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.