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

Knut Krueger rh at knut-krueger.de
Fri Mar 25 13:49:34 CET 2011


Am 25.03.2011 12:56, schrieb Philipp Pagel:
>
> OK - in that case you can't fit the data into data.frame. Possibley
> you cold get what you need using some kind of list structure but I
> think it's better to ask why you need to transpose the data.
>
we have (imported from excel)

frame <- 
data.frame("x0"=c("y1","y2","y3","y4"),"x1"=c(1,2,3,4),"x2"=c(5,6,7,8),"x1"=c(9,10,11,12))
where y1..yn are the names of the rows
we need  frame$x1   .. .  frame$xn
and  frame[1,] .. frame[n,]  but the first column is no the rownames.

if it is possible to rotate the whole dataset we could use

frame$y1 ..frame$y2


Knut



More information about the R-help mailing list