def frequencies type=:count
      counts = @cat_hash.values.map(&:size)
      values =
        case type
        when :count
          counts
        when :fraction
          counts.map { |c| c / size.to_f }
        when :percentage
          counts.map { |c| c / size.to_f * 100 }
        else
          raise ArgumentError, 'Type should be either :count, :fraction or'\
          " :percentage. #{type} not supported."
        end
      Daru::Vector.new values, index: categories, name: name
    end
Returns a vector storing count/frequency of each category
@return [Daru::Vector] Return a vector whose indexes are categories
and corresponding values are its count
@example
dv = Daru::Vector.new [:a, 1, :a, 1, :c], type: :category
dv.frequencies
# => #<Daru::Vector(4)>
#   a   2
#   b   0
#   c   1
#   1   2