[R] does range of values in array include a third value?

Maas James Dr (MED) J.Maas at uea.ac.uk
Thu Feb 17 15:56:38 CET 2011


I'm using the range command to get the minimum and maximum values of an array as in

x <- range(array_y)

which gives me two values such as 

[1] -2 9

I need to be able to test if this range of values includes a third value.  For example I'd like to query 

1) does the range of -2 to 9 include 3, answer TRUE
2) does the range of -2 to 9 include -6, answer FALSE?

All values could be negative or positive.  Is there a R function that will test this or do I need to programme it?  I have searched but not found one.

Thanks

J

===============================
Dr. Jim Maas
University of East Anglia



More information about the R-help mailing list