range_n: Range (Actually Minimum and Maximum) of Numeric Values

Description Usage Arguments Value Examples

View source: R/RcppExports.R

Description

Written in C++, this function should always run faster than range for numeric vectors/matrices. For integer objects, range_i should run even faster.

Usage

1

Arguments

x

Numeric vector or matrix.

Value

Numeric vector.

Examples

1
2
3
4
5
6
7
8
9
# In general, range_n is much faster than range
x <- rnorm(1000)
all.equal(range(x), range_n(x))
benchmark(range(x), range_n(x), replications = 5000)

# For integer vectors, range_i should be even faster
x <- rpois(1000, lambda = 5) 
all.equal(range(x), range_i(x))
benchmark(range(x), range_n(x), range_i(x), replications = 10000)

dvmisc documentation built on May 2, 2019, 5:51 p.m.

Related to range_n in dvmisc...