Re: [R] Grouping and/or splitting

2012-04-04 Thread Berend Hasselman
On 04-04-2012, at 07:15, Ashish Agarwal wrote: Yes. I was missing the DROP argument. But now the problem is splitting is causing some weird ordering of groups. Why weird? See below: DF - read.table(text= Houseid,Personid,Tripid,taz 1,1,1,4 1,1,2,7 2,1,1,96 2,1,2,4 2,1,3,2 2,2,1,58

Re: [R] Grouping and/or splitting

2012-04-04 Thread Ashish Agarwal
Thanks a ton! It was weird because according to me ordering should have by default. Anyways, your workaround along with Weidong's method are both good solutions. On Wed, Apr 4, 2012 at 12:10 PM, Berend Hasselman b...@xs4all.nl wrote: On 04-04-2012, at 07:15, Ashish Agarwal wrote: Yes. I was

[R] Grouping and/or splitting

2012-04-03 Thread Ashish Agarwal
I have a dataframe imported from csv file below: Houseid,Personid,Tripid,taz 1,1,1,4 1,1,2,7 2,1,1,96 2,1,2,4 2,1,3,2 2,2,1,58 There are three groups identified based on the combination of first and second columns. How do I split this data frame? I tried aa - split(inpfil, inpfil[,1:2]) but it

Re: [R] Grouping and/or splitting

2012-04-03 Thread Weidong Gu
how about split(inpfil, paste(inpfil[,1],inpfil[,2],sep=',')) Weidong Gu On Tue, Apr 3, 2012 at 6:42 PM, Ashish Agarwal ashish.agarw...@gmail.com wrote: I have a dataframe imported from csv file below: Houseid,Personid,Tripid,taz 1,1,1,4 1,1,2,7 2,1,1,96 2,1,2,4 2,1,3,2 2,2,1,58

Re: [R] Grouping and/or splitting

2012-04-03 Thread Rui Barradas
Hello, Ashish Agarwal wrote I have a dataframe imported from csv file below: Houseid,Personid,Tripid,taz 1,1,1,4 1,1,2,7 2,1,1,96 2,1,2,4 2,1,3,2 2,2,1,58 There are three groups identified based on the combination of first and second columns. How do I split this data frame? I

Re: [R] Grouping and/or splitting

2012-04-03 Thread Ashish Agarwal
Yes. I was missing the DROP argument. But now the problem is splitting is causing some weird ordering of groups. See below: DF - read.table(text= Houseid,Personid,Tripid,taz 1,1,1,4 1,1,2,7 2,1,1,96 2,1,2,4 2,1,3,2 2,2,1,58 3,1,5,7 , header=TRUE, sep=,) aa - split(DF, DF[, 1:2], drop=TRUE) Now