def to_category opts={}
      dv = Daru::Vector.new to_a, type: :category, name: @name, index: @index
      dv.ordered = opts[:ordered] || false
      dv.categories = opts[:categories] if opts[:categories]
      dv
    end
Converts a non category type vector to category type vector.
@param [Hash] opts options to convert to category
@option opts [true, false] :ordered Specify if vector is ordered or not.
If it is ordered, it can be sorted and min, max like functions would work
@option opts [Array] :categories set categories in the specified order
@return [Daru::Vector] vector with type category