Hi there,

You can add a order column on x or y and after use this field to order z.
Like

z<-z[order(z$orderfield),]

To generate a order on x or y you can do something like

x$xorder<-1:nrow(x)

cheers

milton
On Thu, Dec 24, 2009 at 2:26 PM, <utkarsh.singhal@global-analytics.com>wrote:

>
>   Hi All,
>   I want to "merge" two datasets by column "ID" and I don't want the result
> to
>   be sorted by "ID". I am doing the following:
>   > z = merge(x, y, by = "ID", sort=F)
>   The result is not sorted by "ID". But (as oppose to what I expected) it
> is
>   not even in the original order of either "x" or "y".
>   Can somebody tell what to do if I wanted it to be in the original order
> of
>   x.
>
>   P.S.: As my dataset is very huge and I couldn't find the right subset of
> the
>   data which explains the above problem, so I can't attach it at the
> moment.
>   If anybody knows the answer, please reply; or else I will try to get the
>   right subset.
>
>   Thanks in advance
>
>   Utkarsh
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]


