Class: StatisticsHelper::Series

Inherits:
Array
  • Object
show all
Defined in:
lib/helpers/statistics.rb

Instance Method Summary collapse

Instance Method Details

#meanObject Also known as: average, avg



7
8
9
10
# File 'lib/helpers/statistics.rb', line 7

def mean
	return 0 if size == 0
	avg = sum / size
end

#sumObject



3
4
5
# File 'lib/helpers/statistics.rb', line 3

def sum
	inject(0.0) { |result, el| result + el }
end