vlookup in R?
?findInterval
On Thu, May 27, 2010 at 9:20 PM, Roslina Zakaria <zroslina at yahoo.com> 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]]
______________________________________________ R-help at 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.
Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?