Re: [R] One to One Matching multiple vectors

From: Nick Sabbe <>
Date: Wed, 16 Mar 2011 10:49:39 +0100

Hello Vincy.
You probably want
Or, more instructional:
whereAreZInX<-match(z, x)

HTH, Nick Sabbe

wink: A1.056, Coupure Links 653, 9000 Gent
ring: 09/264.59.36

-- Do Not Disapprove

-----Original Message-----
From: [] On
Behalf Of Vincy Pyne
Sent: woensdag 16 maart 2011 10:42
Subject: [R] One to One Matching multiple vectors

Dear R helpers


x = c(0,  1,  2,  3)

y = c("A", "B", "C", "D")

z = c(1, 3)

For given values of z, I need to the values of y. So I should get "B" and

I tried doing 

y[x][z] but it gives 

> y[x][z]
[1] "A" "C" Kindly guide. Regards Vincy [[alternative HTML version deleted]] ______________________________________________ mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code.
Received on Wed 16 Mar 2011 - 09:52:48 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 16 Mar 2011 - 10:40:22 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive