/working/auteur/R/withinrange.R

http://github.com/eastman/auteur · R · 10 lines · 6 code · 2 blank · 2 comment · 2 complexity · bbe63be7f8059b6d8d3f139e5db95c61 MD5 · raw file

  1. #determines if a value falls within a range [min,max]
  2. #author: JM Eastman 2010
  3. withinrange <-
  4. function(x, min, max) {
  5. a=sign(x-min)
  6. b=sign(x-max)
  7. if(abs(a+b)==2) return(FALSE) else return(TRUE)
  8. }