Method: Utilities::Statistics#mean
- Defined in:
- lib/utilities/utilities.rb
#mean ⇒ Object Also known as: average
Calculate the mean of the array, as long as all objects respond to / operator
52 53 54 55 |
# File 'lib/utilities/utilities.rb', line 52 def mean a = flatten.compact.to_stat (a.size > 0) ? a.sum.to_f / a.size : nil end |