class Benelux::Stats::Group
Attributes
name[RW]
Public Instance Methods
+(other)
click to toggle source
# File lib/benelux/stats.rb, line 66 def +(other) unless @name == other.name raise BeneluxError, "Cannot add #{other.name} to #{@name}" end g = Group.new self g.name = @name g << other g end
<<(other)
click to toggle source
# File lib/benelux/stats.rb, line 76 def <<(other) self.push *other self end
filter(*tags)
click to toggle source
Calls superclass method
Selectable#filter
# File lib/benelux/stats.rb, line 116 def filter(*tags) (f = super).name = @name f end
Also aliased as: []
max()
click to toggle source
# File lib/benelux/stats.rb, line 110 def max() merge.max end
mean()
click to toggle source
# File lib/benelux/stats.rb, line 108 def mean() merge.mean end
merge(*tags)
click to toggle source
# File lib/benelux/stats.rb, line 81 def merge(*tags) #tags = Selectable.normalize tags mc = Calculator.new mc.init_tags! all = tags.empty? ? self : self.filter(tags) all.each { |calc| mc.merge! calc mc.add_tags_quick calc.tags } mc end
min()
click to toggle source
# File lib/benelux/stats.rb, line 109 def min() merge.min end
n()
click to toggle source
# File lib/benelux/stats.rb, line 114 def n() merge.n end
sample(s, tags={})
click to toggle source
# File lib/benelux/stats.rb, line 93 def sample(s, tags={}) raise BeneluxError, "tags must be a Hash" unless Hash === tags c = Calculator.new c.add_tags tags c.sample s self << c nil end
sd()
click to toggle source
# File lib/benelux/stats.rb, line 113 def sd() merge.sd end
sum()
click to toggle source
# File lib/benelux/stats.rb, line 112 def sum() merge.sum end
sumsq()
click to toggle source
# File lib/benelux/stats.rb, line 111 def sumsq() merge.sumsq end
tag_values(tag)
click to toggle source
# File lib/benelux/stats.rb, line 102 def tag_values(tag) vals = self.collect { |calc| calc.tags[tag] } Array.new vals.uniq end