irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'statarray'
=> true
irb(main):003:0> a = [1,2,3,4,6]
=> [1, 2, 3, 4, 6]
irb(main):004:0> sa = a.to_statarray
=> [1, 2, 3, 4, 6]
irb(main):005:0> sa.mean
=> 3.2
irb(main):007:0> sa.median
=> 3
Saturday, August 25, 2007
Ruby Statistics Functions
The StatArray class provides some basic statistical operations to be used on arrays:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment