rsruby 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/test/tc_vars.rb CHANGED
@@ -1,28 +1,28 @@
1
1
  require 'test/unit'
2
2
  require 'rsruby'
3
3
 
4
- unless $r
5
- $r = RSRuby.instance
6
- end
7
-
8
4
  class TestVars < Test::Unit::TestCase
9
5
 
6
+ def setup
7
+ @r = RSRuby.instance
8
+ end
9
+
10
10
  def test_get_vars
11
- $r.eval_R("f<-function(x) x+1")
12
- $r.assign('x',100)
13
- $r.assign('v',(1..10).to_a)
11
+ @r.eval_R("f<-function(x) x+1")
12
+ @r.assign('x',100)
13
+ @r.assign('v',(1..10).to_a)
14
14
  #There is a difference here between RPy and us
15
15
  #a final hash argument is treated as named arguments
16
16
  #to the original function call (assign) not as a list
17
17
  #to be given to the function
18
- $r.c.autoconvert(RSRuby::NO_CONVERSION)
19
- $r.assign('d',$r.c({'a' => 1, 'b' => 2}))
20
- $r.c.autoconvert(RSRuby::BASIC_CONVERSION)
18
+ @r.c.autoconvert(RSRuby::NO_CONVERSION)
19
+ @r.assign('d',@r.c({'a' => 1, 'b' => 2}))
20
+ @r.c.autoconvert(RSRuby::BASIC_CONVERSION)
21
21
 
22
- assert_equal($r.x, 100)
23
- assert_equal($r.v, (1..10).to_a)
24
- assert_equal($r.d, $r.c({'a' => 1, 'b' => 2}))
25
- assert_equal($r.f.class, $r.c.class)
22
+ assert_equal(@r.x, 100)
23
+ assert_equal(@r.v, (1..10).to_a)
24
+ assert_equal(@r.d, @r.c({'a' => 1, 'b' => 2}))
25
+ assert_equal(@r.f.class, @r.c.class)
26
26
  end
27
27
 
28
28
  end
data/test/test_all.rb ADDED
@@ -0,0 +1,21 @@
1
+ #Tests all test cases for rsruby
2
+
3
+ require 'test/unit'
4
+
5
+ require 'tc_array'
6
+ require 'tc_boolean'
7
+ require 'tc_cleanup'
8
+ require 'tc_eval'
9
+ require 'tc_extensions'
10
+ require 'tc_init'
11
+ #require 'tc_io'
12
+ require 'tc_library'
13
+ require 'tc_modes'
14
+ require 'tc_robj'
15
+ #require 'tc_sigint'
16
+ require 'tc_to_ruby'
17
+ require 'tc_to_r'
18
+ require 'tc_util'
19
+ require 'tc_vars'
20
+
21
+
metadata CHANGED
@@ -1,18 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.11
2
+ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: rsruby
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.4.0
7
- date: 2006-11-14 00:00:00 +09:00
8
- summary: An R to Ruby bridge
6
+ version: 0.4.2
7
+ date: 2007-01-16 00:00:00 +09:00
8
+ summary: RSRuby is a bridge library for Ruby giving Ruby developers access to the full R statistical programming environment. RSRuby embeds a full R interpreter inside the running Ruby script, allowing R methods to be called and data passed between the Ruby script and the R interpreter. Most data conversion is handled automatically, but user-definable conversion routines can also be written to handle any R or Ruby class.
9
9
  require_paths:
10
10
  - lib
11
11
  - ext
12
12
  email: alexg@kuicr.kyoto-u.ac.jp
13
13
  homepage: http://web.kuicr.kyoto-u.ac.jp/~alexg/rsruby/
14
- rubyforge_project:
15
- description:
14
+ rubyforge_project: rsruby
15
+ description: RSRuby is a bridge library for Ruby giving Ruby developers access to the full R statistical programming environment. RSRuby embeds a full R interpreter inside the running Ruby script, allowing R methods to be called and data passed between the Ruby script and the R interpreter. Most data conversion is handled automatically, but user-definable conversion routines can also be written to handle any R or Ruby class.
16
16
  autorequire:
17
17
  default_executable:
18
18
  bindir: bin
@@ -26,63 +26,57 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
26
26
  platform: ruby
27
27
  signing_key:
28
28
  cert_chain:
29
+ post_install_message:
29
30
  authors:
30
31
  - Alex Gutteridge
31
32
  files:
32
- - lib/rsruby.rb
33
- - lib/rsruby/robj.rb
34
- - lib/rsruby/erobj.rb
35
- - lib/rsruby/dataframe.rb
36
- - ext/rsruby/Converters.c
37
- - ext/rsruby/rsruby.c
38
- - ext/rsruby/R_eval.c
39
- - ext/rsruby/robj.c
40
- - ext/rsruby/Converters.h
41
- - ext/rsruby/rsruby.h
42
- - ext/rsruby/R_eval.h
43
- - ext/rsruby/extconf.rb
44
- - test/tc_array.rb
45
- - test/tc_boolean.rb
46
- - test/tc_cleanup.rb
47
- - test/tc_eval.rb
48
- - test/tc_io.rb
49
- - test/tc_to_r.rb
50
- - test/tc_library.rb
51
- - test/tc_init.rb
52
- - test/tc_util.rb
53
- - test/tc_modes.rb
54
- - test/tc_robj.rb
55
- - test/tc_sigint.rb
56
- - test/tc_to_ruby.rb
57
- - test/tc_vars.rb
33
+ - History.txt
34
+ - License.txt
35
+ - Manifest.txt
36
+ - README.txt
58
37
  - examples/arrayfields.rb
59
38
  - examples/bioc.rb
60
39
  - examples/dataframe.rb
61
40
  - examples/erobj.rb
62
- - README
63
- test_files:
41
+ - ext/Converters.c
42
+ - ext/Converters.h
43
+ - ext/R_eval.c
44
+ - ext/R_eval.h
45
+ - ext/extconf.rb
46
+ - ext/robj.c
47
+ - ext/rsruby.c
48
+ - ext/rsruby.h
49
+ - lib/rsruby.rb
50
+ - lib/rsruby/dataframe.rb
51
+ - lib/rsruby/erobj.rb
52
+ - lib/rsruby/robj.rb
53
+ - test/table.txt
64
54
  - test/tc_array.rb
65
55
  - test/tc_boolean.rb
66
56
  - test/tc_cleanup.rb
67
57
  - test/tc_eval.rb
58
+ - test/tc_extensions.rb
59
+ - test/tc_init.rb
68
60
  - test/tc_io.rb
69
- - test/tc_to_r.rb
70
61
  - test/tc_library.rb
71
- - test/tc_init.rb
72
- - test/tc_util.rb
73
62
  - test/tc_modes.rb
74
63
  - test/tc_robj.rb
75
64
  - test/tc_sigint.rb
65
+ - test/tc_to_r.rb
76
66
  - test/tc_to_ruby.rb
67
+ - test/tc_util.rb
77
68
  - test/tc_vars.rb
69
+ - test/test_all.rb
70
+ test_files:
71
+ - test/test_all.rb
78
72
  rdoc_options: []
79
73
 
80
- extra_rdoc_files:
81
- - README
74
+ extra_rdoc_files: []
75
+
82
76
  executables: []
83
77
 
84
78
  extensions:
85
- - ext/rsruby/extconf.rb
79
+ - ext/extconf.rb
86
80
  requirements: []
87
81
 
88
82
  dependencies: []
data/README DELETED
@@ -1,102 +0,0 @@
1
- == Introduction
2
-
3
- RSRuby is a partial conversion of RPy (http://rpy.sourceforge.net/), the original RSRuby was based on RSPerl (http://www.omegahat.org/RSPerl/) (hence RSRuby), however almost all the code is now from RPy. RSRuby provides the ability to embed a full R interpreter inside a running Ruby script. R methods can then be called from the Ruby script and data passed between the R interpreter and the Ruby script.
4
-
5
- == License
6
-
7
- Copyright (C) 2006 Alex Gutteridge
8
-
9
- The Original Code is the RPy python module.
10
-
11
- The Initial Developer of the Original Code is Walter Moreira.
12
- Portions created by the Initial Developer are Copyright (C) 2002
13
- the Initial Developer. All Rights Reserved.
14
-
15
- Contributor(s):
16
- Gregory R. Warnes <greg@warnes.net> (RPy Maintainer)
17
-
18
- This library is free software; you can redistribute it and/or
19
- modify it under the terms of the GNU Lesser General Public
20
- License as published by the Free Software Foundation; either
21
- version 2.1 of the License, or (at your option) any later version.
22
-
23
- This library is distributed in the hope that it will be useful,
24
- but WITHOUT ANY WARRANTY; without even the implied warranty of
25
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26
- Lesser General Public License for more details.
27
-
28
- You should have received a copy of the GNU Lesser General Public
29
- License along with this library; if not, write to the Free Software
30
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
31
-
32
- == Installation
33
-
34
- Obviously a working R installation is required. R must have been installed/built with the '--enable-R-shlib' option enabled to provide the R shared library. I have tested on R version 2.2.1, but earlier version might work.
35
-
36
- Firstly, on OS X please set the compiler to gcc 3.3
37
-
38
- sudo gcc_select 3.3
39
-
40
- Then (on all systems) to install:
41
-
42
- 1. Set the R_HOME environment variable appropriately:
43
-
44
- R_HOME=/usr/lib/R (on my Ubuntu Linux box)
45
- R_HOME=/Library/Frameworks/R.framework/Resources (on OS X)
46
-
47
- 2. Compile/install the Ruby library using setup.rb. You need to supply the location of your R installation for the libR shared library. This may be the same as R_HOME, e.g. ('/usr/lib/R' on Ubuntu, '/Library/Frameworks/R.framework/Resources' on OS X):
48
-
49
- cd rsruby
50
- ruby setup.rb config -- --with-R-dir=/usr/lib/R
51
- ruby setup.rb setup
52
- sudo ruby setup.rb install
53
-
54
- If RSRuby does not compile you may need to configure the path to the R library (this wasn't required on either of my machines, but your mileage may vary). From the RPy README, anyone of the following should be sufficient:
55
-
56
- o make a link to RHOME/bin/libR.so in /usr/local/lib or /usr/lib, then
57
- run 'ldconfig',
58
-
59
- o or, put the following line in your .bashrc (or equivalent):
60
-
61
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:RHOME/bin
62
-
63
- o or, edit the file /etc/ld.so.conf and add the following line:
64
-
65
- RHOME/bin
66
-
67
- and then, run 'ldconfig'.
68
-
69
- 3. Test it.
70
-
71
- ruby setup.rb test
72
-
73
- Should pass all tests.
74
-
75
- == Installation Notes
76
-
77
- If you're brave then you can combine the config, setup and install steps into 'sudo ruby setup.rb all -- --with-R-dir=/usr/lib/R'.
78
-
79
- You can avoid needing root/sudo access in the install step by providing setup.rb with a suitable install directory (such as home). Please run 'ruby setup.rb --help' for more details.
80
-
81
- A Ruby Gem version of RSRuby is also available.
82
-
83
- == Usage
84
-
85
- To use (read examples and tests for more hints - the RPy manual will also be helpful until I have written something similar myself!):
86
-
87
- #Initialize R
88
- require 'rsruby'
89
-
90
- #RSRuby uses Singleton design pattern so call instance rather
91
- #than new
92
- r = RSRuby.instance
93
- #Call R functions
94
- data = r.rnorm(100)
95
- r.plot(data)
96
- sleep(2)
97
- #Call with named args
98
- r.plot({'x' => data,
99
- 'y' => data,
100
- 'xlab' => 'test',
101
- 'ylab' => 'test'})
102
- sleep(2)