Function kirstine::mean

source ·
pub fn mean(data: &Vec<f64>) -> f64
Expand description

Arithmetic Mean

Calculates the mean, or the average, of a vector of floats.

Wikipedia

Panics if dataset is empty.

Example

let data = vec![1.0, 3.0, 3.0, 2.0, 1.0];
assert_eq!(kirstine::mean(&data), 2.0);