range {base} | R Documentation |
range
returns a vector containing the minimum and maximum of
all the given arguments.
range(..., na.rm = FALSE)
range.default(..., na.rm = FALSE, finite = FALSE)
... |
any |
na.rm |
logical, indicating if |
finite |
logical, indicating if all non-finite elements should be omitted. |
This is a generic function; currently, it has only a default method
(range.default
).
It is also a member of the Summary
group of functions, see
Methods
.
If na.rm
is FALSE
, NA
and NaN
values in any of the arguments will cause NA values
to be returned, otherwise NA
values are ignored.
If finite
is TRUE
, the minimum
and maximum of all finite values is computed, i.e.,
finite=TRUE
includes na.rm=TRUE
.
A special situation occurs when there is no (after omission
of NA
s) nonempty argument left, see min
.
min
,
max
,
Methods
.
print(r.x <- range(rnorm(100)))
diff(r.x) # the SAMPLE range
x <- c(NA, 1:3, -1:1/0); x
range(x)
range(x, na.rm = TRUE)
range(x, finite = TRUE)