rserve-simpler 0.0.1 → 0.0.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/README.rdoc CHANGED
@@ -9,7 +9,6 @@ the heavy lifting and should be consulted for background.
9
9
 
10
10
  == Synposis
11
11
 
12
-
13
12
  require 'rserve/simpler'
14
13
  r = Rserve::Simpler.new
15
14
 
@@ -127,6 +126,10 @@ for background) and this is "/tmp/Rserve" on my system.
127
126
  # note the connection number dir!
128
127
  # (I haven't figured out how to predict this number)
129
128
 
129
+ === support for NArray
130
+
131
+ NArray vectors work as input to converse, convert, and command.
132
+
130
133
  == TODO
131
134
 
132
135
  * simple option to use pwd as default directory
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -2,6 +2,11 @@
2
2
  require 'rserve'
3
3
  require 'rserve/rexp'
4
4
  require 'rserve/data_frame'
5
+ begin
6
+ require 'narray'
7
+ rescue LoadError
8
+ class NArray ; end
9
+ end
5
10
 
6
11
  class Rserve::Simpler < Rserve::Connection
7
12
 
@@ -16,6 +21,8 @@ class Rserve::Simpler < Rserve::Connection
16
21
  wrapped_lists = obj.hash.values.map {|v| Rserve::REXP::Wrapper.wrap(v) }
17
22
  z = Rserve::Rlist.new(wrapped_lists, obj.hash.keys.map(&:to_s))
18
23
  Rserve::REXP.create_data_frame(z)
24
+ when NArray
25
+ obj.to_a
19
26
  else
20
27
  obj
21
28
  end
@@ -75,6 +75,21 @@ describe 'rserve connection with simpler additions' do
75
75
 
76
76
  end
77
77
 
78
+ begin
79
+ require 'narray'
80
+ describe 'compatible with NArray' do
81
+ before do
82
+ @r = Rserve::Simpler.new
83
+ end
84
+ it 'takes NArray vectors as input' do
85
+ @r.converse(x: NArray[1,2,3], y: NArray[4,5,6]) { "cor(x,y)" }.is 1.0
86
+ end
87
+ end
88
+ rescue LoadError
89
+ xdescribe "compatible with NArray [narray not installed!]"
90
+ end
91
+
92
+
78
93
  if RUBY_VERSION > '1.9'
79
94
 
80
95
  # TODO: write these compatible for 1.8
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - John Prince
@@ -126,7 +126,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
126
126
  requirements:
127
127
  - - ">="
128
128
  - !ruby/object:Gem::Version
129
- hash: -3232687242390354005
129
+ hash: 3908836129131740135
130
130
  segments:
131
131
  - 0
132
132
  version: "0"