true_range_i: True Range of Integer Values

Description Usage Arguments Value Examples

View source: R/RcppExports.R

Description

Defined as the difference between the maximum and the minimum. Equivalent to base R code diff(range(x)), but much faster.

Usage

1

Arguments

x

Integer vector or matrix.

Value

Integer value.

Examples

1
2
3
4
# In general, true_range_i is much faster than diff(range(x))
x <- rpois(1000, lambda = 5)
all.equal(diff(range(x)), true_range_i(x))
benchmark(diff(range(x)), true_range_i(x), replications = 5000)

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