def only_valid as_a=:vector, _duplicate=true
      # FIXME: Now duplicate is just ignored.
      #   There are no spec that fail on this case, so I'll leave it
      #   this way for now - zverok, 2016-05-07

      new_index = @index.to_a - indexes(*Daru::MISSING_VALUES)
      new_vector = new_index.map { |idx| self[idx] }

      if as_a == :vector
        Daru::Vector.new new_vector, index: new_index, name: @name, dtype: dtype
      else
        new_vector
      end
    end
def only_valid as_a=:vector, _duplicate=true
      # FIXME: Now duplicate is just ignored.
      #   There are no spec that fail on this case, so I'll leave it
      #   this way for now - zverok, 2016-05-07

      new_index = @index.to_a - indexes(*Daru::MISSING_VALUES)
      new_vector = new_index.map { |idx| self[idx] }

      if as_a == :vector
        Daru::Vector.new new_vector, index: new_index, name: @name, dtype: dtype
      else
        new_vector
      end
    end
Creates a new vector consisting only of non-nil data

 == Arguments

 @param as_a [Symbol] Passing :array will return only the elements
 as an Array. Otherwise will return a Daru::Vector.

 @param _duplicate [Symbol] In case no missing data is found in the
 vector, setting this to false will return the same vector.
 Otherwise, a duplicate will be returned irrespective of
 presence of missing data.