Skip to content

Rename column or row names

2 messages · thmsfuller066 at gmail.com, T.D. Rudolph

#
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'