Re: [R] splitting a long dataframe

2012-12-26 Thread Swagath
Dear Arun, Thanks a lot for the time and help. Cheers, Swagath On 12/26/12 6:24 AM, arun wrote: Hi, You can do this either by: with(data1,aggregate(y,by=list(x),function(x) x)) #2nd column is a list here #or res1<-split(seq(nrow(data1)),data1$x) #or res1<-tapply(data1$y,list(data1$x),function

Re: [R] splitting a long dataframe

2012-12-26 Thread arun
Hi, You can do this either by: with(data1,aggregate(y,by=list(x),function(x) x)) #2nd column is a list here #or  res1<-split(seq(nrow(data1)),data1$x) #or res1<-tapply(data1$y,list(data1$x),function(x) x) res2<- t(sapply(res1,`[`,1:max(sapply(res1,length res2[cbind(c(rep(8,4),rep(9,4)),c(1:4,1:

Re: [R] splitting a long dataframe

2012-12-25 Thread David Winsemius
On Dec 25, 2012, at 9:52 AM, Swagath wrote: Dear all...Merry Christmas I would like to split a long dataframe. The dataframe looks like this x<-c('0:00:00', '0:30:00', '1:00:00', '1:30:00', '2:00:00', '2:30:00', '3:00:00', '0:00:00', '0:30:00', '1:00:00', '1:30:00', '2:00:00', '2:30:00',