min_i: Minimum of Integer Values

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/functions.R

Description

Written in C++, this function tends to run faster than min for large integer vectors/matrices. Not valid for non-integer objects.

Usage

1
min_i(x)

Arguments

x

Integer vector.

Details

NA

Value

Integer value.

Note

NA

Author(s)

Dane R. Van Domelen

References

Acknowledgment: This material is based upon work supported by the National Science Foundation Graduate Research Fellowship under Grant No. DGE-0940903.

See Also

NA

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# For large objects, min_i is faster than min
x <- rpois(100000, lambda = 5)
min(x) == min_i(x)
microbenchmark(min(x),
               min_i(x),
               times = 100)

# For smaller objects, min_i is slower than min
x <- rpois(100, lambda = 5)
min(x) == min_i(x)
microbenchmark(min(x),
               min_i(x),
               times = 100)

dvmisc documentation built on Dec. 29, 2017, 3:01 a.m.