Re: [R] find value between two other numbers?

2010-08-13 Thread baptiste auguie
Hi, I see no need to construct the vector, try this instead, belong = function(x=4, y=c(1,10)) x = y[2] x = y[1] see also ?findInterval HTH, baptiste On 13 August 2010 01:10, fishkbob fishk...@gmail.com wrote: So basically I want to do this - 4 %in% 1:10 should return true Would

Re: [R] find value between two other numbers?

2010-08-13 Thread fishkbob
Awesome, that works great, and it cuts my runtime down by a lot. thanks baptiste I totally forgot that I could just check to see if the number was inbetween via less than and greater than rather than having to construct the vector. findInterval also helps with another problem I was having

[R] find value between two other numbers?

2010-08-12 Thread fishkbob
So basically I want to do this - 4 %in% 1:10 should return true Would there be another way of doing this without having to do the 1:10 part? I am using a very large data set and trying to do 459124 %in% 103000:983000 multiple times for many values, and it is taking quite a long time Also, I

Re: [R] find value between two other numbers?

2010-08-12 Thread Jorge Ivan Velez
Hi, Here is one way: is.there - function(mynumber, a, b) mynumber %in% a:b is.there(4, 1, 10) [1] TRUE is.there(459124, 103000, 983000) [1] TRUE is.there(4, 103000, 983000) [1] FALSE HTH, Jorge On Thu, Aug 12, 2010 at 7:10 PM, fishkbob wrote: So basically I want to do this - 4 %in%