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 functions used will also be more efficient and better designed than the typical new user. ______________________________________________ R-help@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.