rinruby-edge 2.1.0.edge.1
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.
- checksums.yaml +7 -0
- data/.appveyor.yml +68 -0
- data/.gitignore +6 -0
- data/.travis.yml +23 -0
- data/Gemfile +10 -0
- data/History.txt +66 -0
- data/LICENSE.txt +646 -0
- data/Manifest.txt +11 -0
- data/README.md +9 -0
- data/README_ORIG.md +75 -0
- data/Rakefile +18 -0
- data/lib/rinruby/version.rb +3 -0
- data/lib/rinruby.rb +1028 -0
- data/lib/rinruby_without_r_constant.rb +24 -0
- data/rinruby.gemspec +22 -0
- data/spec/rinruby_spec.rb +441 -0
- data/spec/rinruby_without_r_constant_spec.rb +9 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +35 -0
- metadata +118 -0
data/README_ORIG.md
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
# rinruby
|
2
|
+
* http://rinruby.ddahl.org/
|
3
|
+
|
4
|
+
|
5
|
+
[](https://travis-ci.org/clbustos/rinruby)
|
6
|
+
|
7
|
+
[](https://codeclimate.com/github/clbustos/rinruby/maintainability)
|
8
|
+
|
9
|
+
### DESCRIPTION
|
10
|
+
|
11
|
+
RinRuby is a Ruby library that integrates the R interpreter in Ruby, making R's statistical routines and graphics available within Ruby. The library consists of a single Ruby script that is simple to install and does not require any special compilation or installation of R. Since the library is 100% pure Ruby, it works on a variety of operating systems, Ruby implementations, and versions of R. RinRuby's methods are simple, making for readable code. The [website *rinruby.ddahl.org*](http://rinruby.ddahl.org) describes RinRuby usage, provides comprehensive documentation, gives several examples, and discusses RinRuby's implementation.
|
12
|
+
|
13
|
+
|
14
|
+
Copyright 2005-2008 David B. Dahl
|
15
|
+
|
16
|
+
Developed by David B. Dahl. Documented by David B. Dahl and Scott Crawford
|
17
|
+
|
18
|
+
Homepage: http://rinruby.ddahl.org
|
19
|
+
|
20
|
+
*Maintainer*: Claudio Bustos
|
21
|
+
|
22
|
+
*Contributors*:
|
23
|
+
|
24
|
+
- [fenrir-naru](https://fenrir.naruoka.org)
|
25
|
+
|
26
|
+
### FEATURES/PROBLEMS
|
27
|
+
|
28
|
+
* Pure Ruby. Works on Ruby 2.1, 2.2, 2.4 and JRuby-head (2018/03/29). There isn't any specific code that impides to use Ruby < 2.0, but is deprecated.
|
29
|
+
* Slower than RSRuby, but more robust
|
30
|
+
|
31
|
+
### SYNOPSIS
|
32
|
+
|
33
|
+
Below is a simple example of RinRuby usage for simple linear regression. The simulation parameters are defined in Ruby, computations are performed in R, and Ruby reports the results. In a more elaborate application, the simulation parameter might come from input from a graphical user interface, the statistical analysis might be more involved, and the results might be an HTML page or PDF report.
|
34
|
+
|
35
|
+
#### Code
|
36
|
+
|
37
|
+
require "rinruby"
|
38
|
+
n = 10
|
39
|
+
beta_0 = 1
|
40
|
+
beta_1 = 0.25
|
41
|
+
alpha = 0.05
|
42
|
+
seed = 23423
|
43
|
+
R.x = (1..n).entries
|
44
|
+
R.eval <<EOF
|
45
|
+
set.seed(#{seed})
|
46
|
+
y <- #{beta_0} + #{beta_1}*x + rnorm(#{n})
|
47
|
+
fit <- lm( y ~ x )
|
48
|
+
est <- round(coef(fit),3)
|
49
|
+
pvalue <- summary(fit)$coefficients[2,4]
|
50
|
+
EOF
|
51
|
+
puts "E(y|x) ~= #{R.est[0]} + #{R.est[1]} * x"
|
52
|
+
if R.pvalue < alpha
|
53
|
+
puts "Reject the null hypothesis and conclude that x and y are related."
|
54
|
+
else
|
55
|
+
puts "There is insufficient evidence to conclude that x and y are related."
|
56
|
+
end
|
57
|
+
|
58
|
+
#### Output
|
59
|
+
|
60
|
+
E(y|x) ~= 1.264 + 0.273 * x
|
61
|
+
Reject the null hypothesis and conclude that x and y are related.
|
62
|
+
|
63
|
+
### REQUIREMENTS
|
64
|
+
|
65
|
+
* R
|
66
|
+
|
67
|
+
### INSTALL
|
68
|
+
|
69
|
+
* sudo gem install rinruby
|
70
|
+
|
71
|
+
|
72
|
+
### LICENSE
|
73
|
+
|
74
|
+
GPL-3. See LICENSE.txt for more information.
|
75
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# -*- ruby -*-
|
3
|
+
# -*- coding: utf-8 -*-
|
4
|
+
require 'rubygems'
|
5
|
+
require_relative 'lib/rinruby'
|
6
|
+
begin
|
7
|
+
require 'rspec'
|
8
|
+
require 'rspec/core/rake_task'
|
9
|
+
RSpec::Core::RakeTask.new(:spec)
|
10
|
+
rescue LoadError
|
11
|
+
end
|
12
|
+
|
13
|
+
require 'bundler'
|
14
|
+
|
15
|
+
Bundler::GemHelper.install_tasks
|
16
|
+
|
17
|
+
|
18
|
+
# vim: syntax=ruby
|