Top Level Namespace

Defined Under Namespace

Modules: R2rb, RObj, Rserve Classes: Array, Object, String

Instance Method Summary collapse

Instance Method Details

#find_installed_RObject

TODO: specify a file R4rb.conf to provide multiple R systems location in lib/R4rb.rb read this file to offer the several choices



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'ext/R4rb/extconf.rb', line 8

def find_installed_R

  if RUBY_PLATFORM=~/mingw32/
     ENV["R_HOME"]=`R RHOME`
  elsif RUBY_PLATFORM=~/darwin/
    ENV["R_HOME"]=`R RHOME`.strip
  else
    dirs=["/usr/lib/R","/usr/local/lib/R","/usr/lib64/R","/usr/local/lib64/R"]
   
    dirs.each do |dir|
      if FileTest.exists?(dir)
        return dir
      end
    end

    raise RuntimeError, "couldn't find R Home : R seems to be uninstalled!!"
  end

end

#R2rbObject

puts “First, R4rb initialized to R2rb!”



49
# File 'lib/R4rb/R4rb.rb', line 49

R4rb_is R2rb

#r4rb_makefile(inc, lib, version = nil) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'ext/R4rb/extconf.rb', line 75

def r4rb_makefile(inc,lib,version=nil) 
    $CFLAGS = "-I"+inc+" -I."
    $LDFLAGS = "-L"+lib if lib
    $libs = "-lR"
 
    header = nil

    rb4r_name="R4rb"+((version and version!="orig") ? "."+version : "" )
    $objs = [rb4r_name+".o"]

    dir_config("R4rb")
    create_makefile(rb4r_name)
    File.rename("Makefile", "Makefile-#{version}")
end