Hello, I'm trying to figure out exactly what you want. You have data with three columns (cdf, seq, and rand). You want to take a number in column "rand", find the closest match to it in "cdf" and return the value of "seq" for the same row as the closest match in "cdf"? Since you did not fix (i.e., use the $ in the Excel formula) the G2 and 2 in your formula, should we assume that you would also like to do this for the entire "rand" column (as in Excel by 'dragging' the formula down a column)?
Josh On Thu, May 27, 2010 at 6:20 PM, Roslina Zakaria <[email protected]> wrote: > Hi R-users, > > I would like to search for the values of seq that match my rand values. In > excel I will use =VLOOKUP(G2,$E$2:$F$32,2). For example, for rand=.262 it > will give me approximately seq=120 and rand=0.964293344, seq=460 and etc. > > E F G > cdf seq rand > 0.00E+00 0 0.262123478 > 1.56E-03 20 0.964293344 > 1.55E-02 40 0.494827113 > 5.30E-02 60 0.733726005 > 1.16E-01 80 0.800408948 > 1.97E-01 100 0.925748466 > 2.88E-01 120 0.047578356 > 3.80E-01 140 0.266060366 > 4.68E-01 160 0.125522629 > 5.48E-01 180 0.701193274 > 6.18E-01 200 0.915799432 > 6.79E-01 220 0.735984375 > 7.32E-01 240 0.517838069 > 7.76E-01 260 0.042085025 > 8.13E-01 280 0.568346202 > 8.44E-01 300 0.067140721 > 8.70E-01 320 0.71437727 > 8.92E-01 340 0.712210456 > 9.10E-01 360 0.288460952 > 9.26E-01 380 0.185857723 > 9.38E-01 400 0.108859523 > 9.49E-01 420 0.513351848 > 9.57E-01 440 0.22214423 > 9.65E-01 460 0.500350963 > 9.71E-01 480 0.437818537 > 9.76E-01 500 0.851771599 > 9.80E-01 520 0.803521836 > 9.83E-01 540 0.249824519 > 9.86E-01 560 0.859248634 > 9.88E-01 580 0.126926481 > 9.90E-01 600 0.713431196 > 0.253425703 > 0.830195013 > 0.723929563 > 0.027588733 > 0.091067232 > 0.689504685 > 0.890469069 > 0.710440382 > Thank you so much for your help. > > > > > [[alternative HTML version deleted]] > > > ______________________________________________ > [email protected] 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. > > -- Joshua Wiley Senior in Psychology University of California, Riverside http://www.joshuawiley.com/ ______________________________________________ [email protected] 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.

