class RObject::Convert

Public Class Methods

call_R_without_convert(func, *args) click to toggle source
# File lib/robject/convert.rb, line 5
def self.call_R_without_convert func, *args
  original_mode = RSRuby.get_default_mode
  RSRuby.set_default_mode RSRuby::BASIC_CONVERSION
  result = R.rsruby[func].call(*args)
ensure
  RSRuby.set_default_mode original_mode
  result
end

Public Instance Methods

convert(robj) click to toggle source
# File lib/robject/convert.rb, line 14
def convert robj
  type = check_R_type robj
  [DataFrame, Function, List, Array, Matrix, String, Vector, Integer, Numeric, Base].each do |klass|
    if klass.match? robj, type
      break klass.new robj
    end
  end
end

Private Instance Methods

check_R_type(robj) click to toggle source
# File lib/robject/convert.rb, line 24
def check_R_type robj
  Convert.call_R_without_convert :class, robj
end