Define a variable as range

r, range, variables

Solution

You can use `findInterval`:

range1 <- c(0.001,0.002)
findInterval(0.0015,range1)==1
[1] TRUE

The interval is open on the upper limit by default though (ie 0.002 is not included).

Problem

This might be a stupid question but can I define a variable as a range so that the following would result in TRUE? ``` range1 <- range(0.001-0.002) 0.0015 %in% range1 ```

Original source