On Mar 25, 2011, at 8:49 AM, Knut Krueger wrote:

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.

> frame2 <- frame[,-1]
> rownames(frame2) <- frame[,1]
> t(frame2)
     y1 y2 y3 y4
x1    1  2  3  4
x2    5  6  7  8
x1.1  9 10 11 12

You are the one that provided the funky column names.


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

frame$y1 ..frame$y2

--

David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@r-project.org 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.

Reply via email to