var_i: Sample Variance for Integer Values

Description Usage Arguments Value Examples

View source: R/RcppExports.R

Description

Written in C++, this function should always run faster than var for integer vectors. Not valid for non-integer input vectors.

Usage

1
var_i(x)

Arguments

x

Integer vector.

Value

Numeric value.

Examples

1
2
3
4
# For integer vectors, var_i is typically much faster than var.
x <- rpois(1000, lambda = 5)
all.equal(var(x), var_i(x))
benchmark(var(x), var_i(x), replications = 5000)

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

Related to var_i in dvmisc...