Re: [R] rename cols

From: Anupam Tyagi <>
Date: Tue 12 Sep 2006 - 06:44:03 GMT

Christos Hatzis <christos <at>> writes:

> Try this:
> old.colnames <- colnames(my.439.vars.df)
> old.colnames[old.colnames=="fksm"] <- ""
> old.colnames[old.colnames=="klmk"] <- ""

For a newcomer, it will be useful to have a function like this in the base R: that can take a list of old.names and new.names, and do the assignment. It is far more efficient to have functions that are shared via the R distribution, than having to write own functions for carrying out basic data management tasks, and simple routinely used statistical procedures. Most users would rather spend time on thinking about the substantive work, instead of figuring out how to program---this may be specially true for new users. This way the functions used will also be more efficient and better designed than the typical new user. mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Tue Sep 12 16:54:42 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 12 Sep 2006 - 12:30:05 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.