def initialize_category data, opts={}
      @type = :category
      initialize_core_attributes data

      if opts[:categories]
        validate_categories(opts[:categories])
        add_extra_categories(opts[:categories] - categories)
        order_with opts[:categories]
      end

      # Specify if the categories are ordered or not.
      # By default its unordered
      @ordered = opts[:ordered] || false

      # The coding scheme to code with. Default is dummy coding.
      @coding_scheme = :dummy

      # Base category which won't be present in the coding
      @base_category = @cat_hash.keys.first

      # Stores the name of the vector
      @name = opts[:name]

      # Index of the vector
      @index = coerce_index opts[:index]

      self
    end
Initializes a vector to store categorical data.
@note Base category is set to the first category encountered in the vector.
@param [Array] data the categorical data
@param [Hash] opts the options
@option opts [Boolean] :ordered true if data is ordered, false otherwise
@option opts [Array] :categories categories to associate with the vector.
It add extra categories if specified and provides order of categories also.
@option opts [object] :index gives index to vector. By default its from 0 to size-1
@return the categorical data created
@example
dv = Daru::Vector.new [:a, 1, :a, 1, :c],
type: :category,
ordered: true,
categories: [:a, :b, :c, 1]
# => #<Daru::Vector(5)>
#   0   a
#   1   1
#   2   a
#   3   1
#   4   c