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

______________________________________________
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.

Reply via email to