range2 | R Documentation |
Employs min()
and max()
. However, base::range()
, there is no argument
for removing Inf
values.
range2(x, na.rm = FALSE)
x |
A numeric (or character) vector (see Note in base::min) |
na.rm |
Logical, if |
A numeric
vector of length 2 of the minimum and maximum values,
respectively
x <- rep(1:1e5, 100)
system.time(rep(range(x), 100))
system.time(rep(range2(x), 100))
x[sample(x, 1e5)] <- NA
system.time(rep(range(x, na.rm = TRUE), 100))
system.time(rep(range2(x, na.rm = TRUE), 100))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.