#statistics #median #sorting #standard-deviation #min #mean

onay_stat

Simple crate for calculating sum, mean, median, median but sorted, range, variance, standard deviation, mode, max and min value and their indices

0.1.3 Mar 8, 2022
0.1.2 Jan 30, 2022
0.1.1 Jan 25, 2022
0.1.0 Jan 24, 2022

#1722 in Math

MIT license

16KB
412 lines

onay_stat

crates.io Build Status

Simple crate for calculating sum, mean, median, median but sorted, range, variance, standard deviation, mode, max and min value and their indices.

Example

Import in Cargo.toml file

onay_stat="0.1.3"

Import and initialize from a f64 vector.

use onay_stat::*;
fn main(){
    let mut calc = Calc::new(vec![
            0.4814386506837457,
            0.0339385027520397,
            0.2382140377175458,
            0.2875186407007349,
            0.2041683180134608,
    ]).unwrap();
    calc.run_all();
    calc.display();
}

Printing single calculation

println!(calc.standart_deviation());

Or write the result in a variable

let sd = calc.standart_deviation();

Sample output from display method.

Data [0.4814386506837457, 0.0339385027520397, 0.2382140377175458, 0.2875186407007349, 0.2041683180134608]
Count 5
Total 1.245278149867527
Mean 0.2490556299735054
Median 0.2382140377175458
Sorted median 0.2382140377175458
Mode 0.2041683180134608
Range 0.447500147931706
Variance 0.02077781216605561
Standart Deviation 0.1441451080198548
Max 0.4814386506837457
Max indecies [0]
Min 0.0339385027520397
Min indecies [1]

Dependencies

~1.5MB
~26K SLoC