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

2011-03-25 Thread Bert Gunter
It does not appear to have been clearly noted in this thread that one CANNOT "rotate" a data frame. Data frames are designed to contain mixed types in their columns, which means that to "rotate" the frame, the rows would have to be coerced to a single type, thereby most likely losing the informatio

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

2011-03-25 Thread Kenn Konstabel
Hi Knut, On Fri, Mar 25, 2011 at 10:43 AM, Knut Krueger wrote: > Hi to all, > how could I  to rotate automatically a data sheet which was imported by > read.xls? > >     x1 x2 x3 xn > y1 1   4  7   ...  xn/y1 > y2 2   5  8   xn/y2 > y3 3   6  9    xn/y2 > yn ... ... ...         Xn/Y

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

2011-03-25 Thread Knut Krueger
Am 25.03.2011 14:51, schrieb Philipp Pagel: 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. Thank,s but the only question was to use a common notation like for columns if the excel sheet was

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

2011-03-25 Thread David Winsemius
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

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

2011-03-25 Thread Philipp Pagel
> 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] > # re

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

2011-03-25 Thread Philipp Pagel
> 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 i

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

2011-03-25 Thread Knut Krueger
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("x

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

2011-03-25 Thread Philipp Pagel
> Unfortunately we have mixed types f.e text , dates times , and numbers 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. Maybe someone can suggest an

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

2011-03-25 Thread Knut Krueger
Am 25.03.2011 12:31, schrieb Philipp Pagel: If all the columns (x) are of the same type (e.g. all numeric) you can use t(). Example: Unfortunately we have mixed types f.e text , dates times , and numbers Knut __ R-help@r-project.org mailing list h

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

2011-03-25 Thread Philipp Pagel
On Fri, Mar 25, 2011 at 11:43:31AM +0100, Knut Krueger wrote: > Hi to all, > how could I to rotate automatically a data sheet which was imported > by read.xls? > > x1 x2 x3 xn > y1 1 4 7 ... xn/y1 > y2 2 5 8 xn/y2 > y3 3 6 9xn/y2 > yn ... ... ... Xn/Yn