[R] Renaming columns in data.frame, inserting/removing columns from data.frame
Witold Eryk Wolski
wolski at molgen.mpg.de
Tue Feb 8 20:38:11 CET 2005
Ken Termiso wrote:
> Hello,
>
> I'm hoping that there is an easier way to rename columns in a data
> frame other than by using the names() assignment, which requires you
> to type in all the column names at once for a data.frame, in the case
> that I simply want to rename a single column in a data frame.
>
names(mydataframe)[column.index]<-"new.name"
> Also, is there an easy way to move columns in a data frame around
> relative to the other columns?
>
?subset
or
mydataframe[c("column3","column2","column1")]
> Thanks in advance,
> Ken
>
> ______________________________________________
> 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
>
--
Dipl. bio-chem. Witold Eryk Wolski
MPI-Moleculare Genetic
Ihnestrasse 63-73 14195 Berlin
tel: 0049-30-83875219 __("< _
http://www.molgen.mpg.de/~wolski \__/ 'v'
http://r4proteomics.sourceforge.net || / \
mail: witek96 at users.sourceforge.net ^^ m m
wolski at molgen.mpg.de
More information about the R-help
mailing list