Computes the arithmetic mean of the given data.
data
Raises:
12 13 14 15 16
# File 'lib/rust/stats/descriptive.rb', line 12 def mean(data) raise TypeError, "Expecting Array of numerics" if !data.is_a?(Array) || !data.all? { |e| e.is_a?(Numeric) } return data.sum.to_f / data.size end