class R::Vector
Public Class Methods
new(r_interop)
click to toggle source
Calls superclass method
R::Object::new
# File lib/R_interface/rvector.rb, line 38 def initialize(r_interop) super(r_interop) end
Public Instance Methods
<=>(other_vector)
click to toggle source
# File lib/R_interface/rvector.rb, line 113 def <=>(other_vector) puts "comparison called" end
>>(index)
click to toggle source
# File lib/R_interface/rvector.rb, line 50 def >>(index) raise IndexError.new("index #{index} out of array bounds: -#{index - 1}...#{index - 1}") if (index >= @r_interop.size) @r_interop[index] end
each(result = :vec) { |self| ... }
click to toggle source
# File lib/R_interface/rvector.rb, line 70 def each(result = :vec) case result when :vec # length is a R::Vector, in order to extract its size as a Numeric we need to # use the >> operator (1..length >> 0).each do |i| yield self[i] end when :native (0...length >> 0).each do |i| yield self >> i end else raise "Type #{result} is unknown for method :each" end end
each_with_index(result = :vec) { |self, i| ... }
click to toggle source
# File lib/R_interface/rvector.rb, line 93 def each_with_index(result = :vec) case result when :vec (1..length >> 0).each do |i| yield self[i], i end when :native (0...length >> 0).each do |i| yield self >> i, i end else raise "Type #{result} is unknown for method :each" end end
pop()
click to toggle source
# File lib/R_interface/rvector.rb, line 60 def pop self >> 0 end