Ruby
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
* オブジェクト指向スクリプト言語 Ruby [#i4fab1a6]
このページでは、Ruby (http://www.ruby-lang.org/ ) から R を利用するためのリソースを紹介します。
* RSRuby [#q1341f08]
日本で博士研究員をしていた Alex さんが RSRuby を開発しています。
以下のようなことができるものがリリースされています。(なかお)
require 'rsruby/rsruby'
r = RSRuby.new
r.dnorm(10, 0, 1)
ary = r.rnorm(100)
ary.class #=> Array
r.sample(ary, 10).size #=> 10
r.seq(1, 10, 2) #=> [1, 3, 5, 7, 9]
r.sum(r.seq(1, 10, 2)) #=> 25
r.example("plot")
IO.popen("open Rplots.ps")
require 'pp'
t_test = r.call_R("t.test", r.rnorm(10), r.rnorm(10))
pp t_test
# 0.2 で R の List が Ruby の Hash になるようになりました。
# {"p.value"=>0.462472878695523,
# "null.value"=>0.0,
# "data.name"=>
# ["c(1.01068740782645, 0.865236173115251, 0.93167879993857,
# 1.47581317399776, and c(-1.10211243233737, 0.294063804878213,
# 0.00141122434656126, ", "-0.515217879322734, 0.134116527467575,
# 0.919228278924198, -0.510807008081616, and -0.094686119822364,
# 0.267393824116473, -1.08707057903261, 0.483878745814987, ",
# "0.0988882035656655, -1.69156211087167) and 0.722160284065746,
# 0.596582208806619, -0.117070928181702)"],
# "method"=>"Welch Two Sample t-test",
# "conf.int"=>[-0.500949894573842, 1.05165220135482],
# "alternative"=>"two.sided",
# "estimate"=>[0.271806156655945, -0.00354499673454438],
# "parameter"=>15.6594946878024,
# "statistic"=>0.753253690827231}
** ソース [#o5379196]
Alex さんによる[[[ruby-talk:186592]:http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/186592]]からはじまるスレッドの[[[ruby-talk:187761]:http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/187761]]で RSRuby の開発版を公開しました。
- 公開場所:http://rubyforge.org/projects/rsruby/
- RSRuby Github: http://github.com/alexgutteridge/rsruby/tree/master
* Ruby-RMathlib [#pc65bc0a]
Ruby-RMathlib ( http://raa.ruby-lang.org/project/ruby-rmathlib )
// ( http://raa.ruby-lang.org/list.rhtml?name=ruby-rmathlib )
- Ruby から R Math Library をつかうための拡張ライブラリです。
require 'rmath'
Rmath.dnorm(10, 0, 1) # dnorm(10, 0, 1)
Rmath.dnorm(10, 0, 1, false) # dnorm(10, 0, 1, F)
Rmath.pnorm([0.1,0.2,0.3], 0, 1) # pnorm(c(0.1,0.2,0.3), 0, 1)
Rmath.pnorm([0.1,0.2,0.3], 0, 1) # pnorm(c(0.1,0.2,0.3), 0, 1)
Rmath.qnorm(0.001, 0, 1) # qnorm(0.001, 0, 1)
Rmath.qnorm([0.1,0.2,0.3], 0, 1) # qnorm(c(0.1,0.2,0.3), 0, 1)
Rmath.rnorm(10, 0, 1) # rnorm(10, 0, 1)
終了行:
* オブジェクト指向スクリプト言語 Ruby [#i4fab1a6]
このページでは、Ruby (http://www.ruby-lang.org/ ) から R を利用するためのリソースを紹介します。
* RSRuby [#q1341f08]
日本で博士研究員をしていた Alex さんが RSRuby を開発しています。
以下のようなことができるものがリリースされています。(なかお)
require 'rsruby/rsruby'
r = RSRuby.new
r.dnorm(10, 0, 1)
ary = r.rnorm(100)
ary.class #=> Array
r.sample(ary, 10).size #=> 10
r.seq(1, 10, 2) #=> [1, 3, 5, 7, 9]
r.sum(r.seq(1, 10, 2)) #=> 25
r.example("plot")
IO.popen("open Rplots.ps")
require 'pp'
t_test = r.call_R("t.test", r.rnorm(10), r.rnorm(10))
pp t_test
# 0.2 で R の List が Ruby の Hash になるようになりました。
# {"p.value"=>0.462472878695523,
# "null.value"=>0.0,
# "data.name"=>
# ["c(1.01068740782645, 0.865236173115251, 0.93167879993857,
# 1.47581317399776, and c(-1.10211243233737, 0.294063804878213,
# 0.00141122434656126, ", "-0.515217879322734, 0.134116527467575,
# 0.919228278924198, -0.510807008081616, and -0.094686119822364,
# 0.267393824116473, -1.08707057903261, 0.483878745814987, ",
# "0.0988882035656655, -1.69156211087167) and 0.722160284065746,
# 0.596582208806619, -0.117070928181702)"],
# "method"=>"Welch Two Sample t-test",
# "conf.int"=>[-0.500949894573842, 1.05165220135482],
# "alternative"=>"two.sided",
# "estimate"=>[0.271806156655945, -0.00354499673454438],
# "parameter"=>15.6594946878024,
# "statistic"=>0.753253690827231}
** ソース [#o5379196]
Alex さんによる[[[ruby-talk:186592]:http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/186592]]からはじまるスレッドの[[[ruby-talk:187761]:http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/187761]]で RSRuby の開発版を公開しました。
- 公開場所:http://rubyforge.org/projects/rsruby/
- RSRuby Github: http://github.com/alexgutteridge/rsruby/tree/master
* Ruby-RMathlib [#pc65bc0a]
Ruby-RMathlib ( http://raa.ruby-lang.org/project/ruby-rmathlib )
// ( http://raa.ruby-lang.org/list.rhtml?name=ruby-rmathlib )
- Ruby から R Math Library をつかうための拡張ライブラリです。
require 'rmath'
Rmath.dnorm(10, 0, 1) # dnorm(10, 0, 1)
Rmath.dnorm(10, 0, 1, false) # dnorm(10, 0, 1, F)
Rmath.pnorm([0.1,0.2,0.3], 0, 1) # pnorm(c(0.1,0.2,0.3), 0, 1)
Rmath.pnorm([0.1,0.2,0.3], 0, 1) # pnorm(c(0.1,0.2,0.3), 0, 1)
Rmath.qnorm(0.001, 0, 1) # qnorm(0.001, 0, 1)
Rmath.qnorm([0.1,0.2,0.3], 0, 1) # qnorm(c(0.1,0.2,0.3), 0, 1)
Rmath.rnorm(10, 0, 1) # rnorm(10, 0, 1)
ページ名: