[R] rename cols

Petr Pikal petr.pikal at precheza.cz
Tue Sep 12 14:20:05 CEST 2006


Hi

On 12 Sep 2006 at 6:44, Anupam Tyagi wrote:

To:             	r-help at stat.math.ethz.ch
From:           	Anupam Tyagi <AnupTyagi at yahoo.com>
Date sent:      	Tue, 12 Sep 2006 06:44:03 +0000 (UTC)
Subject:        	Re: [R] rename cols

> Christos Hatzis <christos <at> nuverabio.com> writes:
> 
> > 
> > Try this:
> > 
> > old.colnames <- colnames(my.439.vars.df)
> > old.colnames[old.colnames=="fksm"] <- "new.name.a" 
> > old.colnames[old.colnames=="klmk"] <- "new.name.b"
> 
> 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

R is programming environment and language so more or less even 
newcomers are expected to do some programming. And it is also 
volunteer project. I expect that renaming columns is task which is 
not done very often, so there did not come up anybody who was 
interested in programming such function. 

Also the pool of available functions seems to be quite extensive in 
base R and even bigger in all available packages. Sometimes is hard 
enough to remember correct function name.

There is also excellent help and manual pages with nice copy/paste 
feature examples. I wonder if you ever tried to get some help from 
e.g. Excel help. Quite often you are completely lost.

> functions used will also be more efficient and better designed than
> the typical new user.

If a new user does not wont to use command line syntax he/she can use 
some of available GUIS (see R GUI in home page) e.g. JGR.

Petr

> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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.

Petr Pikal
petr.pikal at precheza.cz



More information about the R-help mailing list