RE: [R] Data frame transpose

2003-09-29 Thread Gabor Grothendieck
, add this: m <- m[order(m$siteid,m$date),] --- On Mon 09/29, < [EMAIL PROTECTED] > wrote: From: [mailto: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Date: Mon, 29 Sep 2003 13:15:36 -0400 Subject: [R] Data frame transpose Hi All,I want to ask if there is a transpose function for data

RE: [R] Data frame transpose

2003-09-29 Thread Gabor Grothendieck
Assuming that the data frame is called m, you can - split the data frame by the values of siteid and date- apply a function to create the new data frame for each such group and - use rbind to put it back together like this: fn <- function(x) { y <- t(x[,4:5]) data.frame( siteid=x[1,1], date=x[1

Re: [R] Data frame transpose

2003-09-29 Thread Thomas W Blackwell
Dave - I'm not sure whether there is already a function which does exactly what you want, because this is kind of a special case. The functions I wold look at are: "by", "aggregate", "tapply", "mapply", and, in the package "nlme" one I didn't know about before called "gapply". But, in your case,

Re: [R] Data frame transpose

2003-09-29 Thread Thomas Lumley
On Mon, 29 Sep 2003 [EMAIL PROTECTED] wrote: > > Hi All, > > I want to ask if there is a transpose function for data frame like the > procedure of transpose in SAS? Because I want to partially transpose a > data frame which contains 5 columns (siteid, date, time, obs, mod), what > I want to do is t

[R] Data frame transpose

2003-09-29 Thread Kang . Daiwen
Hi All, I want to ask if there is a transpose function for data frame like the procedure of transpose in SAS? Because I want to partially transpose a data frame which contains 5 columns (siteid, date, time, obs, mod), what I want to do is to put time as the column variables along with siteid,