or
d = data.frame(Col1=c(1,2,3),Col2=c(2,3,4),Col3=c(3,4,5))
names(d)
names(d)[1] = "NewName1"
names(d)
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/data-frame-column-name-change-tp3220684p3221214.html
Sent from the R help mailing list archive at Nabble.com.
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 want
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]) <- "newn
3 matches
Mail list logo