SlideShare uma empresa Scribd logo
1 de 45
Baixar para ler offline
For the Interactive Design
         Using R
    R




           Tsukuba.R #8

          @yag_ays
•   @yag_ays (   )

•                    M1

    •
    •
•   DBCLS

    •
Tsukuba.R

•   #4

•   #5

•   #6 diagram

•   #7 *blottan*
•
•   R

•   RSRuby
...

•
    •
    •   (   )



    •
http://twitter.com/iNut/status/24541521327
http://www.slideshare.net/ybenjo/tsukubar7-4027417
•
    •
    •

•
•
NM_019441      -371 15918 873 43.9056603773585 NM_029791         -45113 -45199 -45117 0.00190269696232218
NM_172755      -15823 -16895 -16815 0.0634507250665877 NM_133766      373 373 357 0.0448179271708683
NM_026742      -314 -1234 -1234 0.745542949756888 NM_009892        -3272 -10724 -3274 0.694889966430436
NM_133939      -657 -478 -495 0.272450532724505 NM_133685        -113 -117 -1952 0.942110655737705
NM_178592      217 173 201 0.254335260115607 NM_053159           2554 1662 2128 0.536702767749699
NM_030559      934 573 573 0.630017452006981 NM_020586           300 239 221 0.357466063348416
NM_027978      -879 -953 -964 0.0881742738589212 NM_026661         -821 -18169 -18153 0.954813143266003
NM_008819      -9574 -9513 -19638 0.515582034830431 NM_024211       -465 -450 -490 0.0816326530612245
NM_001045864     -154 213 199 2.38311688311688 NM_030113          -2119 -12733 -2119 0.833582030943218
NM_026467      2377 662 192 11.3802083333333 NM_030254          56722 56190 56503 0.00946787684641395
NM_001161851     -524 -2513 12607 6.01671309192201 NM_008828        1054 990 571 0.845884413309983
NM_025797      -544 -407 -549 0.258652094717668 NM_001113198 -106878 -130782 -94520 0.27727057240293
NM_053068      -3535 -1384 -3492 0.608486562942009 NM_001013806 1175 15158 1042 13.5470249520154
NM_026119      1300 18771 1293 13.5174013921114 NM_025379          385 1891 -491 4.85132382892057
NM_025813      12563 4047 3138 3.00350541746335 NM_181070          2161 1481 1486 0.459149223497637
NM_007918      1038 138 1086 6.8695652173913 NM_008929         3803 5213 3406 0.530534351145038
NM_207515      2071 2066 2071 0.00242013552758954 NM_001113417 -69003 -70568 -68990 0.022361410
NM_153056      -275 -296 -302 0.0894039735099338 NM_010738         -51178 -50897 -51175 0.005490640509593
http://jp.makezine.com/blog/2010/07/massive_printable_tree_of_life_grap.html
•
•

•
    •   R

    •   TIBCO Spotfire

    •   Excel
R
   speed dist   data(cars)
1      4    2   head(cars)
2      4   10   cars[1,2]
3      7    4   cars$speed
4      7   22   cars[cars$speed<5,]
5      8   16   apply(cars,2,mean)
6      9   10   table(cars$speed)
7     10   18
8     10   26
9     10   34
10    11   17
R
   speed dist   data(cars)
1      4    2   head(cars)
2      4   10   cars[1,2]
3      7    4   cars$speed
4      7   22   cars[cars$speed<5,]
5      8   16   apply(cars,2,mean)
6      9   10   table(cars$speed)
7     10   18
8     10   26
9     10   34
10    11   17
R
   speed dist   data(cars)
1      4    2   head(cars)
2      4   10   cars[1,2]
3      7    4   cars$speed
4      7   22   cars[cars$speed<5,]
5      8   16   apply(cars,2,mean)
6      9   10   table(cars$speed)
7     10   18
8     10   26
9     10   34
10    11   17
R
   speed dist   data(cars)
1      4    2   head(cars)
2      4   10   cars[1,2]
3      7    4   cars$speed
4      7   22   cars[cars$speed<5,]
5      8   16   apply(cars,2,mean)
6      9   10   table(cars$speed)
7     10   18
8     10   26
9     10   34
10    11   17
R
   speed dist   data(cars)
1      4    2   head(cars)
2      4   10   cars[1,2]
3      7    4   cars$speed
4      7   22   cars[cars$speed<5,]
5      8   16   apply(cars,2,mean)
6      9   10   table(cars$speed)
7     10   18
8     10   26
9     10   34
10    11   17
R
   speed dist   data(cars)
1      4    2   head(cars)
2      4   10   cars[1,2]
3      7    4   cars$speed
4      7   22   cars[cars$speed<5,]
5      8   16   apply(cars,2,mean)
6      9   10   table(cars$speed)
7     10   18
8     10   26
9     10   34
10    11   17
R
   speed dist         data(cars)
1      4    2         head(cars)
2      4   10         cars[1,2]
3      7    4         cars$speed
4      7   22         cars[cars$speed<5,]
5      8   16   ...   apply(cars,2,mean)
6      9   10         table(cars$speed)
7     10   18
8     10   26            speed dist
9     10   34            15.40 42.98
10    11   17
R
   speed dist   data(cars)
1      4    2   head(cars)
2      4   10   cars[1,2]
3      7    4   cars$speed
4      7   22   cars[cars$speed<5,]
5      8   16   apply(cars,2,mean)
6      9   10   table(cars$speed)
7     10   18
8     10   26   4   7   8   9 10 11 12 13
9     10   34   2   2   1   1 3 2 4 4
10    11   17
R




    http://bm2.genes.nig.ac.jp/RGM2/index.php
TIBCO Spotfire

  •   TIBCO Spotfire
      •
      •   R   S-PLUS

“ TIBCO Spotfire Analytics


                      Spotfire




                                                                                  ”
                                http://spotfire.tibco.jp/products/overview/analytics-products.aspx
TIBCO Spotfire
TIBCO Spotfire

•
    •   “Details on Demand”

    •
Excel

•
R   ...

•   R



•   R
    R

•
Rails

•   RSRuby + Ruby on Rails R



    •
•
•
Ruby on Rails

   •   Ruby           web



   •          MySQL   Sqlite3   DB

rails hoge
cd hoge
ruby script/generate scaffold
hoge id:integer val:integer
rake db:migrate
RSRuby

•   “RSRuby is a bridge between Ruby and the R
    interpreted language.”   http://rubyforge.org/projects/rsruby/



    •   Ruby       R

•   Tsukuba.R #7 @jj0c_0jjj

•                                             2009 Feb.



                                         http://open-bio.jp/archive/20070302_OB6/OB6-RSRuby-Gutteridge.pdf
•   Project : misanote
    •   Ruby on Rails    http://g86.dbcls.jp/misanotes/
    •   RSRuby
RSRuby on Rails

•   Rails    RSRuby

•   Rails    RSRuby

•   Rails
RSRuby

sudo gem install -- --with-R-dir=/usr/lib/R




•
    •   Mac OSX   --with-R-dir=/opt/local/
        lib/R
RSRuby

yag_ays@g86:~% irb
> require 'rubygems'
=> true
> require 'rsruby'
=> true
> r = RSRuby.instance
=> #<RSRuby:0x1011e0bc0 ...
> r.rnorm(10)
=> [1.10492948446846, ...
Rails

•   config/environment.rb

Rails::Initializer.run do |config|
  config.gem 'rsruby'
end




•         RSRuby   Ruby 1.9   Rails 3.0
•

•

•   Rails
a = []
open("path/data.txt","r"){|f|
  f.each{|l|
    a.push(l.chomp.split("t")[1].to_i)
  }
}

  •   Ruby

  •   RSRuby              [1,2,3]

  •   RSRuby   read_csv             ...
RSRuby
@misanote.each do |misanote|
 @@r = RSRuby.instance
 @@r.png("path/#{misanote.id}.png")
 @@r.hist(a,:xlab => "x",:ylab => "y",
          :xlim => [-10000, 10000],
          :nclass => 10000,
          :main => "#{misanote.id}")
 @@r.abline(:v => misanote.diff,
            :lty => 1,:lwd => 5,:col => 2)
 @@r.eval_R("dev.off()")
end
Rails
@@r = RSRuby.instance
@@r.png("path/#{misanote.id}.png")
@@r.hist(a, :xlab => "x", :ylab => "y",
         :xlim => [-10000, 10000],
         :nclass => 10000,
         :main => "#{misanote.id}")
@@r.abline(:v => misanote.diff,
           :lty => 1, :lwd => 5, :col => 2)
@@r.eval_R("dev.off()")
a = []
open("path/data.txt","r"){|f|f.each{|l|
a.push(l.split("t")[1].to_i)}}
@misanote.each do |misanote|
  @@r = RSRuby.instance
  @@r.png("path/#{misanote.id}.png")
  @@r.hist(a,
:xlab => "x label", :ylab => "y label",
            RSRuby
:xlim => [-10000, 10000], :nclass => 10000,
:main => "#{misanote.id}")
  @@r.abline(:v => misanote.diff, :lty =>
1, :lwd => 5, :col => 2)
  @@r.eval_R("dev.off()")
end
ID : NM_027468




ID : NM_153774
•


•
    •   ID

    •
•

•
•         ggplot2

•   zip
•   Ajax jQuery

•                 R

•
•
•   Rails

•   RSRuby   ...

•

Mais conteúdo relacionado

Destaque

パターン認識 04 混合正規分布
パターン認識 04 混合正規分布パターン認識 04 混合正規分布
パターン認識 04 混合正規分布
sleipnir002
 
数式を使わずイメージで理解するEMアルゴリズム
数式を使わずイメージで理解するEMアルゴリズム数式を使わずイメージで理解するEMアルゴリズム
数式を使わずイメージで理解するEMアルゴリズム
裕樹 奥田
 

Destaque (9)

Chapter9 2
Chapter9 2Chapter9 2
Chapter9 2
 
Variational AutoEncoder
Variational AutoEncoderVariational AutoEncoder
Variational AutoEncoder
 
Humor Recognition and Humor Anchor Extraction
Humor Recognition and Humor Anchor ExtractionHumor Recognition and Humor Anchor Extraction
Humor Recognition and Humor Anchor Extraction
 
変分ベイズ法の説明
変分ベイズ法の説明変分ベイズ法の説明
変分ベイズ法の説明
 
パターン認識 04 混合正規分布
パターン認識 04 混合正規分布パターン認識 04 混合正規分布
パターン認識 04 混合正規分布
 
数式を使わずイメージで理解するEMアルゴリズム
数式を使わずイメージで理解するEMアルゴリズム数式を使わずイメージで理解するEMアルゴリズム
数式を使わずイメージで理解するEMアルゴリズム
 
現在のDNNにおける未解決問題
現在のDNNにおける未解決問題現在のDNNにおける未解決問題
現在のDNNにおける未解決問題
 
IIBMP2016 深層生成モデルによる表現学習
IIBMP2016 深層生成モデルによる表現学習IIBMP2016 深層生成モデルによる表現学習
IIBMP2016 深層生成モデルによる表現学習
 
猫でも分かるVariational AutoEncoder
猫でも分かるVariational AutoEncoder猫でも分かるVariational AutoEncoder
猫でも分かるVariational AutoEncoder
 

Semelhante a Tsukubar8

Descriptive analytics in r programming language
Descriptive analytics in r programming languageDescriptive analytics in r programming language
Descriptive analytics in r programming language
Ashwini Mathur
 
Quick Wikipedia Mining using Elastic Map Reduce
Quick Wikipedia Mining using Elastic Map ReduceQuick Wikipedia Mining using Elastic Map Reduce
Quick Wikipedia Mining using Elastic Map Reduce
ohkura
 
Data manipulation and visualization in r 20190711 myanmarucsy
Data manipulation and visualization in r 20190711 myanmarucsyData manipulation and visualization in r 20190711 myanmarucsy
Data manipulation and visualization in r 20190711 myanmarucsy
SmartHinJ
 

Semelhante a Tsukubar8 (20)

R Programming: Transform/Reshape Data In R
R Programming: Transform/Reshape Data In RR Programming: Transform/Reshape Data In R
R Programming: Transform/Reshape Data In R
 
第5回 様々なファイル形式の読み込みとデータの書き出し(解答付き)
第5回 様々なファイル形式の読み込みとデータの書き出し(解答付き)第5回 様々なファイル形式の読み込みとデータの書き出し(解答付き)
第5回 様々なファイル形式の読み込みとデータの書き出し(解答付き)
 
Applied Regression Analysis using R
Applied Regression Analysis using RApplied Regression Analysis using R
Applied Regression Analysis using R
 
chapter3
chapter3chapter3
chapter3
 
第5回 様々なファイル形式の読み込みとデータの書き出し
第5回 様々なファイル形式の読み込みとデータの書き出し第5回 様々なファイル形式の読み込みとデータの書き出し
第5回 様々なファイル形式の読み込みとデータの書き出し
 
useR!2010 matome
useR!2010 matomeuseR!2010 matome
useR!2010 matome
 
MH prediction modeling and validation in r (1) regression 190709
MH prediction modeling and validation in r (1) regression 190709MH prediction modeling and validation in r (1) regression 190709
MH prediction modeling and validation in r (1) regression 190709
 
Introduction to tibbles
Introduction to tibblesIntroduction to tibbles
Introduction to tibbles
 
Latin America Tour 2019 - 10 great sql features
Latin America Tour 2019  - 10 great sql featuresLatin America Tour 2019  - 10 great sql features
Latin America Tour 2019 - 10 great sql features
 
Descriptive analytics in r programming language
Descriptive analytics in r programming languageDescriptive analytics in r programming language
Descriptive analytics in r programming language
 
SevillaR meetup: dplyr and magrittr
SevillaR meetup: dplyr and magrittrSevillaR meetup: dplyr and magrittr
SevillaR meetup: dplyr and magrittr
 
vcdで日本語(3) long format が旧世界とのGateway
vcdで日本語(3) long format が旧世界とのGatewayvcdで日本語(3) long format が旧世界とのGateway
vcdで日本語(3) long format が旧世界とのGateway
 
Quick Wikipedia Mining using Elastic Map Reduce
Quick Wikipedia Mining using Elastic Map ReduceQuick Wikipedia Mining using Elastic Map Reduce
Quick Wikipedia Mining using Elastic Map Reduce
 
JTF2018_B30_k8s_operator_nobusue
JTF2018_B30_k8s_operator_nobusueJTF2018_B30_k8s_operator_nobusue
JTF2018_B30_k8s_operator_nobusue
 
Attention-Based Adaptive Selection of Operations for Image Restoration in the...
Attention-Based Adaptive Selection of Operations for Image Restoration in the...Attention-Based Adaptive Selection of Operations for Image Restoration in the...
Attention-Based Adaptive Selection of Operations for Image Restoration in the...
 
Data manipulation and visualization in r 20190711 myanmarucsy
Data manipulation and visualization in r 20190711 myanmarucsyData manipulation and visualization in r 20190711 myanmarucsy
Data manipulation and visualization in r 20190711 myanmarucsy
 
Practical Introduction to Web scraping using R
Practical Introduction to Web scraping using RPractical Introduction to Web scraping using R
Practical Introduction to Web scraping using R
 
Matlab teaching
Matlab teachingMatlab teaching
Matlab teaching
 
Introduction to R
Introduction to RIntroduction to R
Introduction to R
 
Writing Readable Code with Pipes
Writing Readable Code with PipesWriting Readable Code with Pipes
Writing Readable Code with Pipes
 

Tsukubar8

  • 1. For the Interactive Design Using R R Tsukuba.R #8 @yag_ays
  • 2. @yag_ays ( ) • M1 • • • DBCLS •
  • 3. Tsukuba.R • #4 • #5 • #6 diagram • #7 *blottan*
  • 4. • • R • RSRuby
  • 5. ... • • • ( ) •
  • 7. • • • •
  • 8. NM_019441 -371 15918 873 43.9056603773585 NM_029791 -45113 -45199 -45117 0.00190269696232218 NM_172755 -15823 -16895 -16815 0.0634507250665877 NM_133766 373 373 357 0.0448179271708683 NM_026742 -314 -1234 -1234 0.745542949756888 NM_009892 -3272 -10724 -3274 0.694889966430436 NM_133939 -657 -478 -495 0.272450532724505 NM_133685 -113 -117 -1952 0.942110655737705 NM_178592 217 173 201 0.254335260115607 NM_053159 2554 1662 2128 0.536702767749699 NM_030559 934 573 573 0.630017452006981 NM_020586 300 239 221 0.357466063348416 NM_027978 -879 -953 -964 0.0881742738589212 NM_026661 -821 -18169 -18153 0.954813143266003 NM_008819 -9574 -9513 -19638 0.515582034830431 NM_024211 -465 -450 -490 0.0816326530612245 NM_001045864 -154 213 199 2.38311688311688 NM_030113 -2119 -12733 -2119 0.833582030943218 NM_026467 2377 662 192 11.3802083333333 NM_030254 56722 56190 56503 0.00946787684641395 NM_001161851 -524 -2513 12607 6.01671309192201 NM_008828 1054 990 571 0.845884413309983 NM_025797 -544 -407 -549 0.258652094717668 NM_001113198 -106878 -130782 -94520 0.27727057240293 NM_053068 -3535 -1384 -3492 0.608486562942009 NM_001013806 1175 15158 1042 13.5470249520154 NM_026119 1300 18771 1293 13.5174013921114 NM_025379 385 1891 -491 4.85132382892057 NM_025813 12563 4047 3138 3.00350541746335 NM_181070 2161 1481 1486 0.459149223497637 NM_007918 1038 138 1086 6.8695652173913 NM_008929 3803 5213 3406 0.530534351145038 NM_207515 2071 2066 2071 0.00242013552758954 NM_001113417 -69003 -70568 -68990 0.022361410 NM_153056 -275 -296 -302 0.0894039735099338 NM_010738 -51178 -50897 -51175 0.005490640509593
  • 9.
  • 11.
  • 12.
  • 13. • • • • R • TIBCO Spotfire • Excel
  • 14. R speed dist data(cars) 1 4 2 head(cars) 2 4 10 cars[1,2] 3 7 4 cars$speed 4 7 22 cars[cars$speed<5,] 5 8 16 apply(cars,2,mean) 6 9 10 table(cars$speed) 7 10 18 8 10 26 9 10 34 10 11 17
  • 15. R speed dist data(cars) 1 4 2 head(cars) 2 4 10 cars[1,2] 3 7 4 cars$speed 4 7 22 cars[cars$speed<5,] 5 8 16 apply(cars,2,mean) 6 9 10 table(cars$speed) 7 10 18 8 10 26 9 10 34 10 11 17
  • 16. R speed dist data(cars) 1 4 2 head(cars) 2 4 10 cars[1,2] 3 7 4 cars$speed 4 7 22 cars[cars$speed<5,] 5 8 16 apply(cars,2,mean) 6 9 10 table(cars$speed) 7 10 18 8 10 26 9 10 34 10 11 17
  • 17. R speed dist data(cars) 1 4 2 head(cars) 2 4 10 cars[1,2] 3 7 4 cars$speed 4 7 22 cars[cars$speed<5,] 5 8 16 apply(cars,2,mean) 6 9 10 table(cars$speed) 7 10 18 8 10 26 9 10 34 10 11 17
  • 18. R speed dist data(cars) 1 4 2 head(cars) 2 4 10 cars[1,2] 3 7 4 cars$speed 4 7 22 cars[cars$speed<5,] 5 8 16 apply(cars,2,mean) 6 9 10 table(cars$speed) 7 10 18 8 10 26 9 10 34 10 11 17
  • 19. R speed dist data(cars) 1 4 2 head(cars) 2 4 10 cars[1,2] 3 7 4 cars$speed 4 7 22 cars[cars$speed<5,] 5 8 16 apply(cars,2,mean) 6 9 10 table(cars$speed) 7 10 18 8 10 26 9 10 34 10 11 17
  • 20. R speed dist data(cars) 1 4 2 head(cars) 2 4 10 cars[1,2] 3 7 4 cars$speed 4 7 22 cars[cars$speed<5,] 5 8 16 ... apply(cars,2,mean) 6 9 10 table(cars$speed) 7 10 18 8 10 26 speed dist 9 10 34 15.40 42.98 10 11 17
  • 21. R speed dist data(cars) 1 4 2 head(cars) 2 4 10 cars[1,2] 3 7 4 cars$speed 4 7 22 cars[cars$speed<5,] 5 8 16 apply(cars,2,mean) 6 9 10 table(cars$speed) 7 10 18 8 10 26 4 7 8 9 10 11 12 13 9 10 34 2 2 1 1 3 2 4 4 10 11 17
  • 22. R http://bm2.genes.nig.ac.jp/RGM2/index.php
  • 23. TIBCO Spotfire • TIBCO Spotfire • • R S-PLUS “ TIBCO Spotfire Analytics Spotfire ” http://spotfire.tibco.jp/products/overview/analytics-products.aspx
  • 25. TIBCO Spotfire • • “Details on Demand” •
  • 27. R ... • R • R R •
  • 28. Rails • RSRuby + Ruby on Rails R • • •
  • 29. Ruby on Rails • Ruby web • MySQL Sqlite3 DB rails hoge cd hoge ruby script/generate scaffold hoge id:integer val:integer rake db:migrate
  • 30. RSRuby • “RSRuby is a bridge between Ruby and the R interpreted language.” http://rubyforge.org/projects/rsruby/ • Ruby R • Tsukuba.R #7 @jj0c_0jjj • 2009 Feb. http://open-bio.jp/archive/20070302_OB6/OB6-RSRuby-Gutteridge.pdf
  • 31. Project : misanote • Ruby on Rails http://g86.dbcls.jp/misanotes/ • RSRuby
  • 32. RSRuby on Rails • Rails RSRuby • Rails RSRuby • Rails
  • 33. RSRuby sudo gem install -- --with-R-dir=/usr/lib/R • • Mac OSX --with-R-dir=/opt/local/ lib/R
  • 34. RSRuby yag_ays@g86:~% irb > require 'rubygems' => true > require 'rsruby' => true > r = RSRuby.instance => #<RSRuby:0x1011e0bc0 ... > r.rnorm(10) => [1.10492948446846, ...
  • 35. Rails • config/environment.rb Rails::Initializer.run do |config| config.gem 'rsruby' end • RSRuby Ruby 1.9 Rails 3.0
  • 36. • • • Rails
  • 37. a = [] open("path/data.txt","r"){|f| f.each{|l| a.push(l.chomp.split("t")[1].to_i) } } • Ruby • RSRuby [1,2,3] • RSRuby read_csv ...
  • 38. RSRuby @misanote.each do |misanote| @@r = RSRuby.instance @@r.png("path/#{misanote.id}.png") @@r.hist(a,:xlab => "x",:ylab => "y", :xlim => [-10000, 10000], :nclass => 10000, :main => "#{misanote.id}") @@r.abline(:v => misanote.diff, :lty => 1,:lwd => 5,:col => 2) @@r.eval_R("dev.off()") end
  • 39. Rails @@r = RSRuby.instance @@r.png("path/#{misanote.id}.png") @@r.hist(a, :xlab => "x", :ylab => "y", :xlim => [-10000, 10000], :nclass => 10000, :main => "#{misanote.id}") @@r.abline(:v => misanote.diff, :lty => 1, :lwd => 5, :col => 2) @@r.eval_R("dev.off()")
  • 40. a = [] open("path/data.txt","r"){|f|f.each{|l| a.push(l.split("t")[1].to_i)}} @misanote.each do |misanote| @@r = RSRuby.instance @@r.png("path/#{misanote.id}.png") @@r.hist(a, :xlab => "x label", :ylab => "y label", RSRuby :xlim => [-10000, 10000], :nclass => 10000, :main => "#{misanote.id}") @@r.abline(:v => misanote.diff, :lty => 1, :lwd => 5, :col => 2) @@r.eval_R("dev.off()") end
  • 41. ID : NM_027468 ID : NM_153774
  • 42. • • • ID •
  • 43. • • • ggplot2 • zip
  • 44. Ajax jQuery • R •
  • 45. • • Rails • RSRuby ... •