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 <bhh@xs4all.nl> wrote:

>
> 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
> > 3,1,5,7
> > ", header=TRUE, sep=",")
> > aa <- split(DF, DF[, 1:2], drop=TRUE)
> >
> > Now the result is aa[3] should is (3,1) and not (2,2). Why? How can I
> > preserve the ascending order?
> >
>
> Try this
>
> aa[order(names(aa))]
>
> Berend
>
> >> aa[3]
> > $`3.1`
> >  Houseid Personid Tripid taz
> > 7       3        1      5   7
> >> aa[4]
> > $`2.2`
> >  Houseid Personid Tripid taz
> > 6       2        2      1  58
>

	[[alternative HTML version deleted]]

