max_n: Maximum of Numeric Values

Description Usage Arguments Value Examples

View source: R/RcppExports.R

Description

Written in C++, this function tends to run faster than max for large numeric vectors/matrices.

Usage

1
max_n(x)

Arguments

x

Numeric vector.

Value

Numeric value.

Examples

1
2
3
4
5
6
7
8
9
# For large objects, max_n is faster than max
x <- rnorm(100000)
max(x) == max_n(x)
benchmark(max(x), max_n(x), replications = 1000)

# For smaller objects, max_n is slower than max
x <- rnorm(100)
max(x) == max_n(x)
benchmark(max(x), max_n(x), replications = 1000)

vandomed/dvmisc documentation built on Oct. 2, 2020, 9:50 p.m.