Learn R Programming

Laurae (version 0.0.0.9001)

mean2: Fast mean computation

Description

This function allows to perform sum(x) / length(x) in one shot, without performing any background check on the data. Beware of integer overflow!

Usage

mean2(x)

Arguments

x
Type: unknown. The variable to perform sum(x)/length(x) on.

Value

The mean.

Examples

Run this code
mean2(c(1:1000000))

Run the code above in your browser using DataLab