[R] read.xls -> rotate data.frame

Philipp Pagel p.pagel at wzw.tum.de
Fri Mar 25 14:51:07 CET 2011


> I am not 100% sure I understood what you intend to do but I think what
> you are saying is that you would like to address certain rows by name
> rather than by index. Is that correct?
> 
> If so you could solve it like this:
> 
> # assign the desired row names
> rownames(frame) = frame[,1]
> # remove the old name column
> frame <- frame[,2:ncol(frame)]

And adding to my own posting:

removing the column can be done more elegantly:

frame <- frame[,-1]

And I forgot to mention that now you can say things like

frame['x2',]w

The frame$y2 notation still only works for columns, of course.
Maybe, if you tell us some more about your actual analysis, 
more help can be provided.

cu
	Philipp

-- 
Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
Maximus-von-Imhof-Forum 3
85354 Freising, Germany
http://webclu.bio.wzw.tum.de/~pagel/



More information about the R-help mailing list