mean_i: Mean of Integer Values

Description Usage Arguments Value Examples

View source: R/RcppExports.R

Description

Written in C++, this function should always run faster than mean for integer vectors/matrices. Not valid for non-integer objects.

Usage

1
mean_i(x)

Arguments

x

Integer vector or matrix.

Value

Numeric value.

Examples

1
2
3
4
# For integer objects, mean_i is typically much faster than mean.
x <- rpois(100, lambda = 5)
mean(x) == mean_i(x)
benchmark(mean(x), mean_i(x), replications = 10000)

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