class Rserve::REXP::Vector
Attributes
payload[R]
Public Instance Methods
==(o)
click to toggle source
# File lib/rserve/rexp/vector.rb, line 5 def ==(o) #p "Comparing #{self.inspect} with #{o.inspect} gives #{self.payload==o.payload and self.attr==o.attr}" self.class==o.class and self.payload==o.payload and self.attr==o.attr end
length()
click to toggle source
returns the length of the vector (i.e. the number of elements) @return length of the vector
# File lib/rserve/rexp/vector.rb, line 12 def length end
na?()
click to toggle source
returns a boolean vector of the same length as this vector with true
for NA values and false
for any other values @return a boolean vector of the same length as this vector with true
for NA values and false
for any other values */
# File lib/rserve/rexp/vector.rb, line 19 def na? end
to_a()
click to toggle source
Retrieves values as Ruby array NA will be replaced with nils
# File lib/rserve/rexp/vector.rb, line 24 def to_a @payload.map {|v| na?(v) ? nil : v } end
to_ruby_internal()
click to toggle source
# File lib/rserve/rexp/vector.rb, line 27 def to_ruby_internal if @payload.nil? or @payload.size==0 nil elsif @payload.size==1 @payload[0] else @payload.map {|v| na?(v) ? nil : v} end end
vector?()
click to toggle source
# File lib/rserve/rexp/vector.rb, line 14 def vector? true end