Simple Statistics

A Crystal shard for doing simple statistical operations, such as median or standard_deviation. Inspired by the JavaScript version.

Installation

Add the dependency to your shard.yml...

dependencies:
  simple_statistics:
    gitlab: EvanHahn/simple-statistics.cr

...and run shards install.

Usage

require "simple_statistics"

SimpleStatistics.mean([4, 2, 0])
# => 6

SimpleStatistics.median([9, 0, 2, 1, 0])
# => 1

SimpleStatistics.standard_deviation(0..10)
# => 3.162...

For more, refer to the API docs or the source code.