Method: Daru::Index#is_values

Defined in:
lib/daru/index/index.rb

#is_values(*indexes) ⇒ Daru::Vector

Note:

Do not use it to check for Float::NAN as Float::NAN == Float::NAN is false

Return vector of booleans with value at ith position is either true or false depending upon whether index value at position i is equal to any of the values passed in the argument or not

Examples:

dv = Daru::Index.new [1, 2, 3, :one, 'one']
dv.is_values 1, 'one'
# => #<Daru::Vector(5)>
#     0  true
#     1  false
#     2  false
#     3  false
#     4  true

Parameters:

  • *indexes (Array)

    values to equate with

Returns:



232
233
234
235
# File 'lib/daru/index/index.rb', line 232

def is_values(*indexes) # rubocop:disable Style/PredicateName
  bool_array = @relation_hash.keys.map { |r| indexes.include?(r) }
  Daru::Vector.new(bool_array)
end