Top Level Namespace

Defined Under Namespace

Modules: Daru, R, SQLite3 Classes: CADFArray, CADataFrame, CADataFrameGroup, CADataFrameGroupMulti, CADataFramePivot, CArray, RSRuby

Instance Method Summary collapse

Instance Method Details

#R(expr = nil, hash = {}, &block) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/R.rb', line 20

def R (expr = nil, hash = {}, &block)
  if block
    if expr
      raise "don't give both of block and expresion"
    else
      R.instance_exec(&block)
    end
  else
    return R.call(expr, hash)
  end
end

#R!(expr = nil, hash = {}, &block) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/R.rb', line 32

def R! (expr = nil, hash = {}, &block)
  if block
    if expr
      raise "don't give both of block and expresion"
    else
      R.instance_exec(&block)
    end
	elsif expr.is_a?(Hash)
		expr.each do |name, value|
			R.instance.assign name.to_s, value
		end
  else
    return R.exec(expr, hash)
  end
end