def group_by *vectors
      vectors.flatten!
      missing = vectors - @vectors.to_a
      unless missing.empty?
        raise(ArgumentError, "Vector(s) missing: #{missing.join(', ')}")
      end

      vectors = [@vectors.first] if vectors.empty?

      Daru::Core::GroupBy.new(self, vectors)
    end
def group_by *vectors
      vectors.flatten!
      missing = vectors - @vectors.to_a
      unless missing.empty?
        raise(ArgumentError, "Vector(s) missing: #{missing.join(', ')}")
      end

      vectors = [@vectors.first] if vectors.empty?

      Daru::Core::GroupBy.new(self, vectors)
    end
Group elements by vector to perform operations on them. Returns a
 Daru::Core::GroupBy object.See the Daru::Core::GroupBy docs for a detailed
 list of possible operations.

 == Arguments

 * vectors - An Array contatining names of vectors to group by.

 == Usage

   df = Daru::DataFrame.new({
     a: %w{foo bar foo bar   foo bar foo foo},
     b: %w{one one two three two two one three},
     c:   [1  ,2  ,3  ,1    ,3  ,6  ,3  ,8],
     d:   [11 ,22 ,33 ,44   ,55 ,66 ,77 ,88]
   })
   df.group_by([:a,:b,:c]).groups
   #=> {["bar", "one", 2]=>[1],
   # ["bar", "three", 1]=>[3],
   # ["bar", "two", 6]=>[5],
   # ["foo", "one", 1]=>[0],
   # ["foo", "one", 3]=>[6],
   # ["foo", "three", 8]=>[7],
   # ["foo", "two", 3]=>[2, 4]}