Class: RObject::Convert

Inherits:
Object
  • Object
show all
Defined in:
lib/robject/convert.rb

Defined Under Namespace

Classes: NotSupportTypeError

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call_R_without_convert(func, *args) ⇒ Object



5
6
7
8
9
10
11
12
# 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

Instance Method Details

#convert(robj) ⇒ Object



14
15
16
17
18
19
20
21
# 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