Skip to content
Prev 283946 / 398502 Next

Problem with range()

range() is not affected by by options("na.action").  Use
the argument na.rm=TRUE.  For plotting purposes finite=TRUE
is nice, as it skips +-Inf as well.

  > range(c(NA, 1, 2, Inf))
  [1] NA NA
  > range(c(NA, 1, 2, Inf), na.rm=TRUE)
  [1]   1 Inf
  > range(c(NA, 1, 2, Inf), finite=TRUE)
  [1] 1 2

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com