Function kirstine::range

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

Arithmetic Range

Calculates the arithmetic range, and coefficient of range, of a dataset.

The return value is a tuple of the range, the coefficient of range, and a tuple of largest and smallest value: (range, coef_of_range, (&smallest, &largest))

Example

let data = vec![89.0, 73.0, 84.0, 91.0, 87.0, 77.0, 94.0];
let (range, coef_of_range, (smallest, largest)) = kirstine::range(&data);
assert_eq!(range, 21.0);
assert!((coef_of_range - 0.1257).abs() < 0.0001);
assert_eq!(smallest, &73.0);
assert_eq!(largest, &94.0);