Function russell_stat::ave[][src]

pub fn ave<T>(x: &[T]) -> Result<f64, &'static str> where
    T: Into<f64> + Copy
Expand description

Returns the average of values in the a given slice

Example

use russell_stat;
let x = [2, 4, 4, 4, 5, 5, 7, 9];
let result = russell_stat::ave(&x);
assert_eq!(result.unwrap(), 5.0);