SlideShare una empresa de Scribd logo
1 de 29
Descargar para leer sin conexión
TOKYO.R #18
1. 
2. 
3.             R
      i. 
      ii. 
      iii.     demo())
      iv. 
      v. 
      vi. 
      vii.         fucntion)
      viii. 
4. 
5. 
                                         Mac
                               Windows
•                :
•  Twitter       :aad34210
•                :http://pracmper.blogspot.com/
•                :
•                :
•                :                  Web
•  R


•  R

• 
R




• 

•        R
     …
• 

•                    …




                         TokyoR




     Amazon
          (¥3,990)
R                 -       
•  R



 http://www.r-project.org/
R       -   
• 
     ������                       




          R
R       -       
•        …




                 R


                         ������ command + enter
R            -           
       quit()           R   R




•  R

•               R
R               -                    
•            iris
•    R                                   demo()




                    demo(graphics)
R   -   
•  Retern
R      -                          
• 
•  “Iris”


  iris
         head(iris , 10)
   tail(iris , 10)
R           -                                
   • 
   • 


Iris$Sepal.Length
     Iris[,1] | iris[1,1]
      head(iris[,1] , 10)




                     Iris[ , ]

                                               Iris
R   –                               
• 
•  R
•          apply

                   apply               ,            ,

                   •  apply(iris[1:4] , 2 , sum)
                        

                   •  apply(iris[1:4] , 2 , mean)
                        

                   •  apply(iris[1:4] , 2 , sd)
                        

                   •  apply(iris[1:4] , 2 ,quantile)
                        
R   –                               
• 
•  R
•          apply

                   apply               ,            ,

                   •  apply(iris[1:4] , 2 , sum)
                        

                   •  apply(iris[1:4] , 2 , mean)
                        

                   •  apply(iris[1:4] , 2 , sd)
                        

                   •  apply(iris[1:4] , 2 ,quantile)
                        
R              –                                  
• 
•        tapply()


                        tapply                ,                 ,

                        •  tapply(iris[,1] , iris[,5] , sum)
                              

                        •  tapply(iris[,1] , iris[,5] , mean)
                              

                        •  tapply(iris[,1] , iris[,5] , sd)
                              

                        •  tapply(iris[,1] , iris[,5] , quantile)
                              
R             –                                    
•  aggregate()
• 


                 aggregate(            ,            ,     )

                 •  aggregate(iris[,1:4] , list(name = iris$Species) , sum)
                      

                 •  aggregate(iris[,1:4] , list(name = iris$Species) , mean)
                      

                 •  aggregate(iris[,1:4] , list(name = iris$Species) , sd)
                      

                 •  aggregate(iris[,1:4] , list(name = iris$Species) , quantile)
                      
R                  –                               
    • 
    •  ggplot2              ”plyr”      SQL                  ”sqldf”


■            ggplot2
                     ■             sqldf
ddply(full_list,                          sqldf SELECT
c("Subject","Class"),                               Species ,
 function(df)                                       COUNT(*) as num
return(c(AVERAGE=mean(df                         FROM
$RT))))
                                            iris
                                                 GROUP BY
                                                    Species


■                                             ■
  http://cran.r-project.org/web/               http://code.google.com/p/sqldf/
   packages/plyr/index.html                     http://www.slideshare.net/aad34210/
  http://plyr.had.co.nz/
                       tokyo-r-sqldf
                                                            TokyoR
R          –              
•                              sum() , mean()
•  R           Excel
• 

       
               
                                        
Sum()      
                                            Sum(iris[,1])
                                                        
Mean() 
                                            
   Mean(iris[,1])
sd() 
                                              
   Sd(iris[,1])
                                                        
Var()
                                          
       Var(iris[,1])
Max() 
                                                 max(iris[,1])
Min()
                                                  Min(iris[,1])
Rank()
                                                 rank(iris[,1])
Cor()
                                                  cor(iris[,1] , iris[,
                                                        2])
R                –              
• 

•  http://cran.r-project.org/doc/contrib/Short-refcard.pdf
    ������ Math
    ������ R
        Cheet Sheet
R                    –                        FUNCTION)
•  R                                                              …
• 
������           function
• 



judge_value <- function(v) {                       Judge_value
                 z <- ifelse(v >= 0 , "+" , "-")            v 0
                 print(z)
                 }

judge_value(v <- -10)         −
judge_value(v <- 10)

                             +
R        –       FUNCTION)
•                     …
•    Function()
R                          –                                
     •                           R
     • 

              

     •                                                              R


■                                           

                                                R
                                                                                          
         
                   
                                       
•                                           •  Install.packages()   •              Vignettes   • 
•         CRAN Task View
            •  http://cran.r-project.org/
               web/views/
•                                                                   •  http://cran.r-
•         Twitter Facebook                                             project.org/web/
•         Yahoo!                                                       packages/zoo/
                                                                       index.html
R           –             
•  Install.packages()
•  ggplot2
                            •  install.packages("ggplot2”)


                            • 

                            •  Library(ggplot2)
•    R
•            R




• 
• 
• 
• 
• 

     1.        CRAN         R                   DL

     2.        demo()

     3.        iris , iris$Sepal.length , iris[1,1] , head(iris , 10)

     4.        apply    , aggregate , plyr , sqldf

     5.        sum() , mean() , sd() …

     6.        function()

     7.        install.packages()
m(___)m

Más contenido relacionado

Destacado

Rで解く最適化問題 線型計画問題編
Rで解く最適化問題   線型計画問題編 Rで解く最適化問題   線型計画問題編
Rで解く最適化問題 線型計画問題編
Hidekazu Tanaka
 
Rで学ぶ現代ポートフォリオ理論入門 - TokyoR #18
Rで学ぶ現代ポートフォリオ理論入門 - TokyoR #18Rで学ぶ現代ポートフォリオ理論入門 - TokyoR #18
Rで学ぶ現代ポートフォリオ理論入門 - TokyoR #18
horihorio
 
パターン認識 08 09 k-近傍法 lvq
パターン認識 08 09 k-近傍法 lvqパターン認識 08 09 k-近傍法 lvq
パターン認識 08 09 k-近傍法 lvq
sleipnir002
 

Destacado (20)

Tokyo r 10_12
Tokyo r 10_12Tokyo r 10_12
Tokyo r 10_12
 
Tokyor16
Tokyor16Tokyor16
Tokyor16
 
Rで解く最適化問題 線型計画問題編
Rで解く最適化問題   線型計画問題編 Rで解く最適化問題   線型計画問題編
Rで解く最適化問題 線型計画問題編
 
Tokyo r21 2
Tokyo r21 2Tokyo r21 2
Tokyo r21 2
 
3次元のデータをグラフにする(Tokyo.R#17)
3次元のデータをグラフにする(Tokyo.R#17)3次元のデータをグラフにする(Tokyo.R#17)
3次元のデータをグラフにする(Tokyo.R#17)
 
Rデバッグあれこれ
RデバッグあれこれRデバッグあれこれ
Rデバッグあれこれ
 
R6パッケージの紹介―機能と実装
R6パッケージの紹介―機能と実装R6パッケージの紹介―機能と実装
R6パッケージの紹介―機能と実装
 
近似ベイズ計算によるベイズ推定
近似ベイズ計算によるベイズ推定近似ベイズ計算によるベイズ推定
近似ベイズ計算によるベイズ推定
 
Tokyo webmining 複雑ネットワークとデータマイニング
Tokyo webmining 複雑ネットワークとデータマイニングTokyo webmining 複雑ネットワークとデータマイニング
Tokyo webmining 複雑ネットワークとデータマイニング
 
Tokyo r28 1
Tokyo r28 1Tokyo r28 1
Tokyo r28 1
 
Rで学ぶ現代ポートフォリオ理論入門 - TokyoR #18
Rで学ぶ現代ポートフォリオ理論入門 - TokyoR #18Rで学ぶ現代ポートフォリオ理論入門 - TokyoR #18
Rで学ぶ現代ポートフォリオ理論入門 - TokyoR #18
 
Tokyo r24 r_graph_tutorial
Tokyo r24 r_graph_tutorialTokyo r24 r_graph_tutorial
Tokyo r24 r_graph_tutorial
 
ggplot2 110129
ggplot2 110129ggplot2 110129
ggplot2 110129
 
[db tech showcase Tokyo 2015] C32:「データ一貫性にこだわる日立のインメモリ分散KVS~こだわりの理由と実現方法とは~」 ...
[db tech showcase Tokyo 2015] C32:「データ一貫性にこだわる日立のインメモリ分散KVS~こだわりの理由と実現方法とは~」 ...[db tech showcase Tokyo 2015] C32:「データ一貫性にこだわる日立のインメモリ分散KVS~こだわりの理由と実現方法とは~」 ...
[db tech showcase Tokyo 2015] C32:「データ一貫性にこだわる日立のインメモリ分散KVS~こだわりの理由と実現方法とは~」 ...
 
Tokyo r21 修正版
Tokyo r21 修正版Tokyo r21 修正版
Tokyo r21 修正版
 
RをAWSで使おう
RをAWSで使おうRをAWSで使おう
RをAWSで使おう
 
ROS の活用による屋外の歩行者空間に適応した自律移動ロボットの開発
ROS の活用による屋外の歩行者空間に適応した自律移動ロボットの開発ROS の活用による屋外の歩行者空間に適応した自律移動ロボットの開発
ROS の活用による屋外の歩行者空間に適応した自律移動ロボットの開発
 
パターン認識 08 09 k-近傍法 lvq
パターン認識 08 09 k-近傍法 lvqパターン認識 08 09 k-近傍法 lvq
パターン認識 08 09 k-近傍法 lvq
 
R言語で始めよう、データサイエンス(ハンズオン勉強会) 〜機会学習・データビジュアライゼーション事始め〜
R言語で始めよう、データサイエンス(ハンズオン勉強会) 〜機会学習・データビジュアライゼーション事始め〜R言語で始めよう、データサイエンス(ハンズオン勉強会) 〜機会学習・データビジュアライゼーション事始め〜
R言語で始めよう、データサイエンス(ハンズオン勉強会) 〜機会学習・データビジュアライゼーション事始め〜
 
Tokyo r33 beginner
Tokyo r33 beginnerTokyo r33 beginner
Tokyo r33 beginner
 

Similar a Tokyo r18

楽々Scalaプログラミング
楽々Scalaプログラミング楽々Scalaプログラミング
楽々Scalaプログラミング
Tomoharu ASAMI
 
From Lisp to Clojure/Incanter and RAn Introduction
From Lisp to Clojure/Incanter and RAn IntroductionFrom Lisp to Clojure/Incanter and RAn Introduction
From Lisp to Clojure/Incanter and RAn Introduction
elliando dias
 
Datamining R 4th
Datamining R 4thDatamining R 4th
Datamining R 4th
sesejun
 
R - Basic Introduction
R - Basic IntroductionR - Basic Introduction
R - Basic Introduction
KU by ADDI
 
Extend R with C!!!
Extend R with C!!!Extend R with C!!!
Extend R with C!!!
mickey24
 
Unit 4 hw 1 - coordinate plane, d&r, midpoint
Unit 4   hw 1 - coordinate plane, d&r, midpointUnit 4   hw 1 - coordinate plane, d&r, midpoint
Unit 4 hw 1 - coordinate plane, d&r, midpoint
Lori Rapp
 

Similar a Tokyo r18 (20)

楽々Scalaプログラミング
楽々Scalaプログラミング楽々Scalaプログラミング
楽々Scalaプログラミング
 
From Lisp to Clojure/Incanter and RAn Introduction
From Lisp to Clojure/Incanter and RAn IntroductionFrom Lisp to Clojure/Incanter and RAn Introduction
From Lisp to Clojure/Incanter and RAn Introduction
 
Great BigTable and my toys
Great BigTable and my toysGreat BigTable and my toys
Great BigTable and my toys
 
Using Raspberry Pi GPU for DNN
Using Raspberry Pi GPU for DNNUsing Raspberry Pi GPU for DNN
Using Raspberry Pi GPU for DNN
 
Data Manipulation Using R (& dplyr)
Data Manipulation Using R (& dplyr)Data Manipulation Using R (& dplyr)
Data Manipulation Using R (& dplyr)
 
Rug hogan-10-03-2012
Rug hogan-10-03-2012Rug hogan-10-03-2012
Rug hogan-10-03-2012
 
R v01 rprogamming_basic01 (R 프로그래밍 기본)
R v01 rprogamming_basic01 (R 프로그래밍 기본)R v01 rprogamming_basic01 (R 프로그래밍 기본)
R v01 rprogamming_basic01 (R 프로그래밍 기본)
 
Extending Spark SQL API with Easier to Use Array Types Operations with Marek ...
Extending Spark SQL API with Easier to Use Array Types Operations with Marek ...Extending Spark SQL API with Easier to Use Array Types Operations with Marek ...
Extending Spark SQL API with Easier to Use Array Types Operations with Marek ...
 
Datamining R 4th
Datamining R 4thDatamining R 4th
Datamining R 4th
 
Hadoop london
Hadoop londonHadoop london
Hadoop london
 
R - Basic Introduction
R - Basic IntroductionR - Basic Introduction
R - Basic Introduction
 
Extend R with C!!!
Extend R with C!!!Extend R with C!!!
Extend R with C!!!
 
R Workshop for Beginners
R Workshop for BeginnersR Workshop for Beginners
R Workshop for Beginners
 
tutorial5
tutorial5tutorial5
tutorial5
 
tutorial5
tutorial5tutorial5
tutorial5
 
Introduction to R
Introduction to RIntroduction to R
Introduction to R
 
Geoff Rothman Presentation on Parallel Processing
Geoff Rothman Presentation on Parallel ProcessingGeoff Rothman Presentation on Parallel Processing
Geoff Rothman Presentation on Parallel Processing
 
my$talk=qr{((?:ir)?reg(?:ular )?exp(?:ressions?)?)}i;
my$talk=qr{((?:ir)?reg(?:ular )?exp(?:ressions?)?)}i;my$talk=qr{((?:ir)?reg(?:ular )?exp(?:ressions?)?)}i;
my$talk=qr{((?:ir)?reg(?:ular )?exp(?:ressions?)?)}i;
 
Prolog 7-Languages
Prolog 7-LanguagesProlog 7-Languages
Prolog 7-Languages
 
Unit 4 hw 1 - coordinate plane, d&r, midpoint
Unit 4   hw 1 - coordinate plane, d&r, midpointUnit 4   hw 1 - coordinate plane, d&r, midpoint
Unit 4 hw 1 - coordinate plane, d&r, midpoint
 

Más de Takashi Minoda

Más de Takashi Minoda (20)

Introduction r (R入門)
Introduction r (R入門)Introduction r (R入門)
Introduction r (R入門)
 
RStudioでRをはじめよう(R for Beginner using RStudio)
RStudioでRをはじめよう(R for Beginner using RStudio)RStudioでRをはじめよう(R for Beginner using RStudio)
RStudioでRをはじめよう(R for Beginner using RStudio)
 
RからGoogle Cloud Vision API を利用する
RからGoogle Cloud Vision API を利用するRからGoogle Cloud Vision API を利用する
RからGoogle Cloud Vision API を利用する
 
TokyoR:RMarkdownでレポート作成
TokyoR:RMarkdownでレポート作成TokyoR:RMarkdownでレポート作成
TokyoR:RMarkdownでレポート作成
 
Rとデータベース 第61回 Tokyo.R
Rとデータベース 第61回 Tokyo.RRとデータベース 第61回 Tokyo.R
Rとデータベース 第61回 Tokyo.R
 
Tokyo r50 beginner_2
Tokyo r50 beginner_2Tokyo r50 beginner_2
Tokyo r50 beginner_2
 
Tokyo r49 beginner
Tokyo r49 beginnerTokyo r49 beginner
Tokyo r49 beginner
 
Tokyo r47 beginner
Tokyo r47 beginnerTokyo r47 beginner
Tokyo r47 beginner
 
Tokyo r47 beginner_2
Tokyo r47 beginner_2Tokyo r47 beginner_2
Tokyo r47 beginner_2
 
Tokyo r45 beginner_2
Tokyo r45 beginner_2Tokyo r45 beginner_2
Tokyo r45 beginner_2
 
Tokyo r39 beginner
Tokyo r39 beginnerTokyo r39 beginner
Tokyo r39 beginner
 
Tokyo r38
Tokyo r38Tokyo r38
Tokyo r38
 
Tokyo r30 anova_part2
Tokyo r30 anova_part2Tokyo r30 anova_part2
Tokyo r30 anova_part2
 
Tokyo r30 anova
Tokyo r30 anovaTokyo r30 anova
Tokyo r30 anova
 
Tokyo r30 beginner
Tokyo r30 beginnerTokyo r30 beginner
Tokyo r30 beginner
 
Tokyo r sqldf
Tokyo r sqldfTokyo r sqldf
Tokyo r sqldf
 
ggplot2 110129
ggplot2 110129ggplot2 110129
ggplot2 110129
 
Japan r 101127
Japan r 101127Japan r 101127
Japan r 101127
 
Tokyo r r_excel
Tokyo r r_excelTokyo r r_excel
Tokyo r r_excel
 
Tokyo r no8_海外サイトの紹介
Tokyo r no8_海外サイトの紹介Tokyo r no8_海外サイトの紹介
Tokyo r no8_海外サイトの紹介
 

Último

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Último (20)

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 

Tokyo r18

  • 2. 1.  2.  3.  R i.  ii.  iii.  demo()) iv.  v.  vi.  vii.  fucntion) viii.  4.  5.  Mac Windows
  • 3. •  : •  Twitter :aad34210 •  :http://pracmper.blogspot.com/ •  : •  : •  : Web
  • 5.
  • 7. •  •  … TokyoR Amazon (¥3,990)
  • 8. R - •  R http://www.r-project.org/
  • 9. R - •  ������ R
  • 10. R - •  … R ������ command + enter
  • 11. R - quit() R R •  R •  R
  • 12. R - •  iris •  R demo() demo(graphics)
  • 13. R - •  Retern
  • 14. R - •  •  “Iris” iris head(iris , 10) tail(iris , 10)
  • 15. R - •  •  Iris$Sepal.Length Iris[,1] | iris[1,1] head(iris[,1] , 10) Iris[ , ] Iris
  • 16. R – •  •  R •  apply apply , , •  apply(iris[1:4] , 2 , sum)   •  apply(iris[1:4] , 2 , mean)   •  apply(iris[1:4] , 2 , sd)   •  apply(iris[1:4] , 2 ,quantile)  
  • 17. R – •  •  R •  apply apply , , •  apply(iris[1:4] , 2 , sum)   •  apply(iris[1:4] , 2 , mean)   •  apply(iris[1:4] , 2 , sd)   •  apply(iris[1:4] , 2 ,quantile)  
  • 18. R – •  •  tapply() tapply , , •  tapply(iris[,1] , iris[,5] , sum)   •  tapply(iris[,1] , iris[,5] , mean)   •  tapply(iris[,1] , iris[,5] , sd)   •  tapply(iris[,1] , iris[,5] , quantile)  
  • 19. R – •  aggregate() •  aggregate( , , ) •  aggregate(iris[,1:4] , list(name = iris$Species) , sum)   •  aggregate(iris[,1:4] , list(name = iris$Species) , mean)   •  aggregate(iris[,1:4] , list(name = iris$Species) , sd)   •  aggregate(iris[,1:4] , list(name = iris$Species) , quantile)  
  • 20. R – •  •  ggplot2 ”plyr” SQL ”sqldf” ■ ggplot2 ■ sqldf ddply(full_list, sqldf SELECT c("Subject","Class"), Species , function(df) COUNT(*) as num return(c(AVERAGE=mean(df FROM $RT)))) iris GROUP BY Species ■ ■   http://cran.r-project.org/web/   http://code.google.com/p/sqldf/ packages/plyr/index.html   http://www.slideshare.net/aad34210/   http://plyr.had.co.nz/ tokyo-r-sqldf   TokyoR
  • 21. R – •  sum() , mean() •  R Excel •  Sum() Sum(iris[,1]) Mean() Mean(iris[,1]) sd() Sd(iris[,1]) Var() Var(iris[,1]) Max() max(iris[,1]) Min() Min(iris[,1]) Rank() rank(iris[,1]) Cor() cor(iris[,1] , iris[, 2])
  • 22. R – •  •  http://cran.r-project.org/doc/contrib/Short-refcard.pdf ������ Math ������ R Cheet Sheet
  • 23. R – FUNCTION) •  R … •  ������ function •  judge_value <- function(v) { Judge_value z <- ifelse(v >= 0 , "+" , "-") v 0 print(z) } judge_value(v <- -10) − judge_value(v <- 10) +
  • 24. R – FUNCTION) •  … •  Function()
  • 25. R – •  R •    •  R ■ R •  •  Install.packages() •  Vignettes •  •  CRAN Task View •  http://cran.r-project.org/ web/views/ •  •  http://cran.r- •  Twitter Facebook project.org/web/ •  Yahoo! packages/zoo/ index.html
  • 26. R – •  Install.packages() •  ggplot2 •  install.packages("ggplot2”) •  •  Library(ggplot2)
  • 27. •  R •  R •  •  •  • 
  • 28. •  1.  CRAN R DL 2.  demo() 3.  iris , iris$Sepal.length , iris[1,1] , head(iris , 10) 4.  apply , aggregate , plyr , sqldf 5.  sum() , mean() , sd() … 6.  function() 7.  install.packages()