Re: [R] re order vector in order given by another vector

2008-08-07 Thread Henrique Dallazuanna
Try this: xx[match(zz, xx)] On Thu, Aug 7, 2008 at 8:20 AM, jimineep <[EMAIL PROTECTED]> wrote: > > So imagine I have a vector: > > zz = c("a","c","d","b") > > and another vector: > > xx = c("d","c","a","b") > > I need to get xx in the same order as zz. I am sure this is very simple but > I can't

[R] re order vector in order given by another vector

2008-08-07 Thread jimineep
So imagine I have a vector: zz = c("a","c","d","b") and another vector: xx = c("d","c","a","b") I need to get xx in the same order as zz. I am sure this is very simple but I can't figure it out from the help pages for order or sort. Perhaps I'm not trying hard enough but its been bugging me fo