[R] Rename column or row names

thmsfuller066 at gmail.com thmsfuller066 at gmail.com
Wed Jul 14 00:51:53 CEST 2010


Hello All,

Suppose that x is a data.frame. I want to change the colname 'oldname'
to 'newname'. I have the following code. Could anybody let me know if
there is any better way to change a column name?

colnames(x)[grep('oldname', colnames(x))]='newname'

-- 
Tom



More information about the R-help mailing list