Re: [R] VLOOKUP in R - tried everything.

2011-06-03 Thread Ethan Brown
Even after I discovered match(), it took me a little while to figure out how to use it for this task, so to add on to Peter's comment--to add a column for total for each value of "coll.minus.release", try the following: data$ParasitoidMatch <- data$ParasitoidTotal[match(data$coll.minus.release, da

Re: [R] VLOOKUP in R - tried everything.

2011-06-03 Thread David Winsemius
On Jun 3, 2011, at 12:43 PM, peter dalgaard wrote: On Jun 3, 2011, at 16:59 , bjmjarrett wrote: I am attempting to emulate the VLOOKUP function from Excel in R. I want to compare one column (coll.minus.release) with another (release.days) to get the number of parasitoid released at that tim

Re: [R] VLOOKUP in R - tried everything.

2011-06-03 Thread peter dalgaard
On Jun 3, 2011, at 16:59 , bjmjarrett wrote: > I am attempting to emulate the VLOOKUP function from Excel in R. > > I want to compare one column (coll.minus.release) with another > (release.days) to get the number of parasitoid released at that time > (TotalParasitoids). > > for example: > >

[R] VLOOKUP in R - tried everything.

2011-06-03 Thread bjmjarrett
I am attempting to emulate the VLOOKUP function from Excel in R. I want to compare one column (coll.minus.release) with another (release.days) to get the number of parasitoid released at that time (TotalParasitoids). for example: coll.minus.release release.daysParasitoidTotal -12

Re: [R] vlookup in R?

2010-05-28 Thread Dennis Murphy
Hi: I think the idea here is to use the cdf intervals as the lookup table for rand (the entire vector) and then return the seq value corresponding to the found interval. Combining the ideas from Jim Holtman (use findInterval()) and Josh Wiley, what worked for me was to split the OP's data into thr

Re: [R] vlookup in R?

2010-05-27 Thread Joshua Wiley
Does this do what you are looking for? ### #Create data based off what you provided datasamp <- structure(list(cdf = c(0, 0.00156, 0.0155, 0.053, 0.116, 0.197, 0.288, 0.38, 0.468, 0.548, 0.618, 0.679, 0.732, 0.776, 0.813, 0.844, 0.87, 0.892, 0.91, 0.926, 0.938, 0.949, 0.95

Re: [R] vlookup in R?

2010-05-27 Thread jim holtman
?findInterval On Thu, May 27, 2010 at 9:20 PM, Roslina Zakaria 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.964293

Re: [R] vlookup in R?

2010-05-27 Thread Joshua Wiley
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.

[R] vlookup in R?

2010-05-27 Thread Roslina Zakaria
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

Re: [R] vlookup in R

2008-03-24 Thread Sachin J
t.org Sent: Monday, March 24, 2008 12:43:42 PM Subject: Re: [R] vlookup in R # Setup the translation map transMap <- c(A="R", B="R", C="R", D="B", F="B"); # The input data v3 <- c("A", "C", "D", "F", "

Re: [R] vlookup in R

2008-03-24 Thread jim holtman
gt; CR > BR > BR > BR > BR > AR > DB > > > > Thanks in advance for your help. > > > > - Original Message > From: Henrique Dallazuanna <[EMAIL PROTECTED]> > To: Sachin J <[EMAIL PROTECTED]> > Cc: r-help@r-project.org > Sent:

Re: [R] vlookup in R

2008-03-24 Thread Henrik Bengtsson
; V1V2 > A R > BR > CR > DB > FB > > > df2 > > V3V4 > AR > CR > DB > FB > AR > CR > BR > BR > BR > BR > AR > DB > > > > Thanks in advance for your help. > > > > > - Original Mess

Re: [R] vlookup in R

2008-03-24 Thread Sachin J
: Monday, March 24, 2008 10:41:52 AM Subject: Re: [R] vlookup in R I think that merge is what you want: set.seed(24032008) x <- data.frame(ID=sample(10), Value=rnorm(10)) idx <- sample(5) merge(idx, x, by.x=1, by.y=1) On 24/03/2008, Sachin J <[EMAIL PROTECTED]> wrote: > Hi, > >

Re: [R] vlookup in R

2008-03-24 Thread David Winsemius
Sachin J <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Is there are function similar to excel vlookup in R. Please let me > know. > Caveat: definition of VLOOKUP done from memory and by checking OO.o Calc function of same name. (Don't have Excel on this machine.) VLOOKUP looks up a s

Re: [R] vlookup in R

2008-03-24 Thread jim holtman
?findInterval On 3/24/08, Sachin J <[EMAIL PROTECTED]> wrote: > Hi, > > Is there are function similar to excel vlookup in R. Please let me know. > > Thanks, > Sachin > > > > > > >[[alternative HTML v

Re: [R] vlookup in R

2008-03-24 Thread Henrique Dallazuanna
I think that merge is what you want: set.seed(24032008) x <- data.frame(ID=sample(10), Value=rnorm(10)) idx <- sample(5) merge(idx, x, by.x=1, by.y=1) On 24/03/2008, Sachin J <[EMAIL PROTECTED]> wrote: > Hi, > > Is there are function similar to excel vlookup in R. Please let me know. > > Thanks

[R] vlookup in R

2008-03-24 Thread Sachin J
Hi, Is there are function similar to excel vlookup in R. Please let me know. Thanks, Sachin [[alternative HTML version deleted]] __ R-help@r-project