Another way:

If x is a two column matrix, as suggested by Henrique D., 

   ID        Value
1   7  0.000656733
2   6  0.201764789
3   1  0.671113391
4  10 -0.739727826
5   9 -1.111310154
6   5 -0.859455833
7   2 -1.408229877
8   8  0.993126295
9   3 -0.171906808
10  4 -0.140107677

And you are looking up the value corresponding to "ID"

 ID <- 4

x[(1:dim(x)[1])[x[,1]==ID],2]

will also do it, and you can vary the value of the 2 in order to query
the column of interest, much as you can do with vlookup in the E
program.

Ben 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Sachin J
Sent: Monday, March 24, 2008 9:25 AM
To: r-help@r-project.org
Subject: [PS] [R] vlookup in R

Hi,

Is there are function similar to excel vlookup in R. Please let me know.

Thanks,
Sachin

______________________________________________
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
and provide commented, minimal, self-contained, reproducible code.

Reply via email to