SlideShare uma empresa Scribd logo
1 de 15
R



sesejun@is.ocha.ac.jp
     2009/10/1
R

• http://r-project.org/   DL
  • Mac, Win, Linux
•          S-Plus
•
• Interactive shell
•
•                    :)
•                              Applications
                         R
    •    Version             2.6 (
                     )
    •    R project            DL


•                              1+1[RET]


> 1+1                                > 8/3
[1] 2                                [1] 2.666667
> 3*6                                > as.integer(8/3)
[1] 18                               [1] 2
> 3^3                                > 8%%3
[1] 27                               [1] 2
&
           > c(1,2,3)
           [1] 1 2 3

> x <- 2   > c(1,2,3) + c(4,5,6)
> y <- 3   [1] 5 7 9
> x*y      > c(1,2,3) * c(4,5,6)
[1] 6      [1] 4 10 18
> x^y
[1] 8
           > c(1,2,3) * 2
           [1] 2 4 6
           > c(1,2,3) / 2
           [1] 0.5 1.0 1.5

           > v <- c(1,2,3)
           > w <- v + 3
           > w
           [1] 4 5 6
           > v*w
           [1] 4 10 18
> v <- c(3,2,5,7,2,4,3,1,4)

> length(v)
[1] 9
> max(v)
[1] 7
> min(v)
[1] 1
> mean(v)
[1] 3.444444
> median(v)
[1] 3
> unique(v)
[1] 3 2 5 7 4 1
> sort(v)
[1] 1 2 2 3 3 4 4 5 7
> order(v)
[1] 8 2 5 1 7 6 9 3 4

> hist(v)
> help(max)
> v <- c(3,2,5,7,2,4,3,1,4)

> hist(v, main="My First Histgram", col="gray")
> hist(v, col="gray", main="My First Histgram")

> w <- sort(v)
> plot(v,w)
> plot(w,v)
> seq(1,4)
[1] 1 2 3 4
> 1:4
[1] 1 2 3 4
> seq(1,5,by=2)
[1] 1 3 5
> rep(1,4)
[1] 1 1 1 1
> rep(1:3,2)
[1] 1 2 3 1 2 3

> v <- c(3,2,5,7,2,4,3,1,4)
> v[1]
[1] 3
> v[c(1,3,5)]
[1] 3 5 2
> v[c(5,3,1)]
[1] 2 5 3

> v[c(F,F,T,T,F,F,T,T,F)]
[1] 5 7 3 1
> x   <- 3
> x
[1]   3
> x   == 3
[1]   TRUE
> x   == 5
[1]   FALSE
> x   < 5
[1]   TRUE

> v <- c(3,2,5,7,2,4,3,1,4)
> v == c(3,3,3,3,3,3,3,3,3)
[1] TRUE FALSE FALSE FALSE
FALSE FALSE TRUE FALSE FALSE
> v == 3
[1] TRUE FALSE FALSE FALSE
FALSE FALSE TRUE FALSE FALSE


> v < 3
[1] FALSE TRUE FALSE FALSE
TRUE FALSE FALSE TRUE FALSE
> v <- c(3,2,5,7,2,4,3,1,4)
> v < 3
[1] FALSE TRUE FALSE FALSE
TRUE FALSE FALSE TRUE FALSE
> v[v<3]
[1] 2 2 1
> v[v>3]
[1] 5 7 4 4
> v[v>3 & v<7]
[1] 5 4 4

> (1:length(v))[v<3]
[1] 2 5 8

> sum(v>3)
[1] 4

> v %in% c(2,3,4)
[1] TRUE TRUE FALSE FALSE
TRUE TRUE TRUE FALSE TRUE
> v[v %in% c(2,3,4)]
[1] 3 2 2 4 3 4
> runif(10,min=0,max=1)
 [1] 0.45189074 0.15543373 0.04654874 0.56946222 0.06086409
 [6] 0.64340708 0.91820279 0.28365751 0.91056890 0.61600679
>   n <- 10
>   hist(runif(n,min=0,max=1), main=paste("n=",n,sep=""))
>   n <- 10000
>   hist(runif(n,min=0,max=1), main=paste("n=",n,sep=""))
.
> n <- 10
> x <- runif(n,min=0,max=1)
> x
 [1] 0.9308879 0.6457174 0.7480667 0.9277555 0.2432229 0.7852049
 [7] 0.9005295 0.3948717 0.3442392 0.7808671
> x < 0.3
 [1] FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE
> sum(x < 0.3)
[1] 1
> sum(x < 0.3)/n
[1] 0.1

> n <- 10000
> x <- runif(n,min=0,max=1)
> sum(x < 0.3)/n
[1] 0.3013

> n <- 10000
> x <- rnorm(n,mean=0,sd=1)
> sum(x < 0.3)/n
[1] 0.6125
> sum(x > 1.0)/n
[1] 0.1591
> m <- matrix((1:9)**2,nrow=3)
> m
     [,1] [,2] [,3]
[1,]    1   16   49
[2,]    4   25   64
[3,]    9   36   81
> m[c(2,3),c(2,3)]
     [,1] [,2]
[1,]    25   64
[2,]    36   81
> m[2,]
[1] 4 25 64
> m[c(1,2),]
     [,1] [,2] [,3]
[1,]     1   16  49
[2,]     4   25  64
> m[,2]
[1] 16 25 36
> m<50
     [,1] [,2] [,3]
[1,] TRUE TRUE TRUE
[2,] TRUE TRUE FALSE
[3,] TRUE TRUE FALSE
> m <- matrix((1:9)**2,nrow=3)
> solve(m)
           [,1]     [,2]        [,3]
[1,] 1.291667 -2.166667 0.9305556
[2,] -1.166667 1.666667 -0.6111111
[3,] 0.375000 -0.500000 0.1805556
> eigen(m)
$values
[1] 112.9839325 -6.2879696     0.3040371

$vectors
           [,1]       [,2]       [,3]
[1,] -0.3993327 -0.8494260 0.7612507
[2,] -0.5511074 -0.4511993 -0.6195403
[3,] -0.7326760 0.2736690 0.1914866



> v <- c(3,2,5,7,2,4,3,1,4)
> t(v) %*% v
     [,1]
[1,] 133
R
•   R                                               ≠



•
    •        if          for
•                                                          R


    •
    •   apply family (
                               R   apply, sapply, lapply       )
    •
•
•   R



                                       WEB
•   R-Tips:
    •   http://cse.naro.affrc.go.jp/takezawa/r-tips/r.html
•   RjpWiki
    •   http://www.okada.jp.org/RWiki/



•   R

Mais conteúdo relacionado

Mais procurados

ゲーム理論BASIC 演習6 -仁を求める-
ゲーム理論BASIC 演習6 -仁を求める-ゲーム理論BASIC 演習6 -仁を求める-
ゲーム理論BASIC 演習6 -仁を求める-ssusere0a682
 
ゲーム理論BASIC 演習3 -安定集合を求める-
ゲーム理論BASIC 演習3 -安定集合を求める-ゲーム理論BASIC 演習3 -安定集合を求める-
ゲーム理論BASIC 演習3 -安定集合を求める-ssusere0a682
 
ゲーム理論BASIC 演習1 -3人ゲームのナッシュ均衡+α-
ゲーム理論BASIC 演習1 -3人ゲームのナッシュ均衡+α-ゲーム理論BASIC 演習1 -3人ゲームのナッシュ均衡+α-
ゲーム理論BASIC 演習1 -3人ゲームのナッシュ均衡+α-ssusere0a682
 
ゲーム理論BASIC 演習7 -シャープレイ値を求める-
ゲーム理論BASIC 演習7 -シャープレイ値を求める-ゲーム理論BASIC 演習7 -シャープレイ値を求める-
ゲーム理論BASIC 演習7 -シャープレイ値を求める-ssusere0a682
 
Kaggle Google Quest Q&A Labeling 反省会 LT資料 47th place solution
Kaggle Google Quest Q&A Labeling 反省会 LT資料 47th place solutionKaggle Google Quest Q&A Labeling 反省会 LT資料 47th place solution
Kaggle Google Quest Q&A Labeling 反省会 LT資料 47th place solutionKen'ichi Matsui
 
{tidytext}と{RMeCab}によるモダンな日本語テキスト分析
{tidytext}と{RMeCab}によるモダンな日本語テキスト分析{tidytext}と{RMeCab}によるモダンな日本語テキスト分析
{tidytext}と{RMeCab}によるモダンな日本語テキスト分析Takashi Kitano
 
ゲーム理論BASIC 演習30 -左右の靴ゲーム-
ゲーム理論BASIC 演習30 -左右の靴ゲーム-ゲーム理論BASIC 演習30 -左右の靴ゲーム-
ゲーム理論BASIC 演習30 -左右の靴ゲーム-ssusere0a682
 
Longest common sub sequence & 0/1 Knapsack
Longest common sub sequence & 0/1 KnapsackLongest common sub sequence & 0/1 Knapsack
Longest common sub sequence & 0/1 KnapsackAsif Shahriar
 
Compfuncdiff
CompfuncdiffCompfuncdiff
Compfuncdiffdianenz
 
{shiny}と{leaflet}による地図アプリ開発Tips
{shiny}と{leaflet}による地図アプリ開発Tips{shiny}と{leaflet}による地図アプリ開発Tips
{shiny}と{leaflet}による地図アプリ開発TipsTakashi Kitano
 
【演習】Re:ゲーム理論入門 第11回 -非協力ゲームにおける交渉ゲーム-
【演習】Re:ゲーム理論入門 第11回 -非協力ゲームにおける交渉ゲーム-【演習】Re:ゲーム理論入門 第11回 -非協力ゲームにおける交渉ゲーム-
【演習】Re:ゲーム理論入門 第11回 -非協力ゲームにおける交渉ゲーム-ssusere0a682
 

Mais procurados (18)

ゲーム理論BASIC 演習6 -仁を求める-
ゲーム理論BASIC 演習6 -仁を求める-ゲーム理論BASIC 演習6 -仁を求める-
ゲーム理論BASIC 演習6 -仁を求める-
 
Data Types
Data TypesData Types
Data Types
 
ゲーム理論BASIC 演習3 -安定集合を求める-
ゲーム理論BASIC 演習3 -安定集合を求める-ゲーム理論BASIC 演習3 -安定集合を求める-
ゲーム理論BASIC 演習3 -安定集合を求める-
 
ゲーム理論BASIC 演習1 -3人ゲームのナッシュ均衡+α-
ゲーム理論BASIC 演習1 -3人ゲームのナッシュ均衡+α-ゲーム理論BASIC 演習1 -3人ゲームのナッシュ均衡+α-
ゲーム理論BASIC 演習1 -3人ゲームのナッシュ均衡+α-
 
Data types
Data typesData types
Data types
 
Htdp01
Htdp01Htdp01
Htdp01
 
ゲーム理論BASIC 演習7 -シャープレイ値を求める-
ゲーム理論BASIC 演習7 -シャープレイ値を求める-ゲーム理論BASIC 演習7 -シャープレイ値を求める-
ゲーム理論BASIC 演習7 -シャープレイ値を求める-
 
The chain rule
The chain ruleThe chain rule
The chain rule
 
exam 1
exam 1exam 1
exam 1
 
2621008 - C++ 4
2621008 -  C++ 42621008 -  C++ 4
2621008 - C++ 4
 
Kaggle Google Quest Q&A Labeling 反省会 LT資料 47th place solution
Kaggle Google Quest Q&A Labeling 反省会 LT資料 47th place solutionKaggle Google Quest Q&A Labeling 反省会 LT資料 47th place solution
Kaggle Google Quest Q&A Labeling 反省会 LT資料 47th place solution
 
{tidytext}と{RMeCab}によるモダンな日本語テキスト分析
{tidytext}と{RMeCab}によるモダンな日本語テキスト分析{tidytext}と{RMeCab}によるモダンな日本語テキスト分析
{tidytext}と{RMeCab}によるモダンな日本語テキスト分析
 
ゲーム理論BASIC 演習30 -左右の靴ゲーム-
ゲーム理論BASIC 演習30 -左右の靴ゲーム-ゲーム理論BASIC 演習30 -左右の靴ゲーム-
ゲーム理論BASIC 演習30 -左右の靴ゲーム-
 
Longest common sub sequence & 0/1 Knapsack
Longest common sub sequence & 0/1 KnapsackLongest common sub sequence & 0/1 Knapsack
Longest common sub sequence & 0/1 Knapsack
 
Compfuncdiff
CompfuncdiffCompfuncdiff
Compfuncdiff
 
Ch10
Ch10Ch10
Ch10
 
{shiny}と{leaflet}による地図アプリ開発Tips
{shiny}と{leaflet}による地図アプリ開発Tips{shiny}と{leaflet}による地図アプリ開発Tips
{shiny}と{leaflet}による地図アプリ開発Tips
 
【演習】Re:ゲーム理論入門 第11回 -非協力ゲームにおける交渉ゲーム-
【演習】Re:ゲーム理論入門 第11回 -非協力ゲームにおける交渉ゲーム-【演習】Re:ゲーム理論入門 第11回 -非協力ゲームにおける交渉ゲーム-
【演習】Re:ゲーム理論入門 第11回 -非協力ゲームにおける交渉ゲーム-
 

Destaque

Connect Life - Work - Trade - Taquara - Comercialização: 55 (21) 99219-0640...
Connect  Life - Work - Trade - Taquara  - Comercialização: 55 (21) 99219-0640...Connect  Life - Work - Trade - Taquara  - Comercialização: 55 (21) 99219-0640...
Connect Life - Work - Trade - Taquara - Comercialização: 55 (21) 99219-0640...Marcelo Silva
 
National Council Magazine 2015 Coleman article
National Council Magazine 2015 Coleman articleNational Council Magazine 2015 Coleman article
National Council Magazine 2015 Coleman articleCarol McCullough
 
MHTSEP15_pg66-68_Cendol for Soul
MHTSEP15_pg66-68_Cendol for SoulMHTSEP15_pg66-68_Cendol for Soul
MHTSEP15_pg66-68_Cendol for SoulLim Teck Choon
 
Ohp Seijoen H20 05 Hairetsu
Ohp Seijoen H20 05 HairetsuOhp Seijoen H20 05 Hairetsu
Ohp Seijoen H20 05 Hairetsusesejun
 
Vila das Fontes Residencial - Vila da Penha - 55 (21) 99219-0640 WhatsApp | 7...
Vila das Fontes Residencial - Vila da Penha - 55 (21) 99219-0640 WhatsApp | 7...Vila das Fontes Residencial - Vila da Penha - 55 (21) 99219-0640 WhatsApp | 7...
Vila das Fontes Residencial - Vila da Penha - 55 (21) 99219-0640 WhatsApp | 7...Marcelo Silva
 
SQL Server Data Synchronization with Office 365
SQL Server Data Synchronization with Office 365SQL Server Data Synchronization with Office 365
SQL Server Data Synchronization with Office 365Layer2
 
Terug Naar De Kust Grontmij Juni 2008
Terug Naar De Kust Grontmij Juni 2008Terug Naar De Kust Grontmij Juni 2008
Terug Naar De Kust Grontmij Juni 2008Astrid_2010
 
Elegance Freguesia - Comercialização: 55 (21) 99219-0640 WhatsApp ou (21) 781...
Elegance Freguesia - Comercialização: 55 (21) 99219-0640 WhatsApp ou (21) 781...Elegance Freguesia - Comercialização: 55 (21) 99219-0640 WhatsApp ou (21) 781...
Elegance Freguesia - Comercialização: 55 (21) 99219-0640 WhatsApp ou (21) 781...Marcelo Silva
 
Sql Server Analysis Server SSAS OLAP Integration Office 365
Sql Server Analysis Server SSAS OLAP Integration Office 365Sql Server Analysis Server SSAS OLAP Integration Office 365
Sql Server Analysis Server SSAS OLAP Integration Office 365Layer2
 
To a wild rose - Edward Mac Dowell
To a wild rose -  Edward Mac DowellTo a wild rose -  Edward Mac Dowell
To a wild rose - Edward Mac Dowelldavid bonnin
 

Destaque (15)

Connect Life - Work - Trade - Taquara - Comercialização: 55 (21) 99219-0640...
Connect  Life - Work - Trade - Taquara  - Comercialização: 55 (21) 99219-0640...Connect  Life - Work - Trade - Taquara  - Comercialização: 55 (21) 99219-0640...
Connect Life - Work - Trade - Taquara - Comercialização: 55 (21) 99219-0640...
 
National Council Magazine 2015 Coleman article
National Council Magazine 2015 Coleman articleNational Council Magazine 2015 Coleman article
National Council Magazine 2015 Coleman article
 
Plezier 2
Plezier 2Plezier 2
Plezier 2
 
K9 Handler
K9 HandlerK9 Handler
K9 Handler
 
MHTSEP15_pg66-68_Cendol for Soul
MHTSEP15_pg66-68_Cendol for SoulMHTSEP15_pg66-68_Cendol for Soul
MHTSEP15_pg66-68_Cendol for Soul
 
Ohp Seijoen H20 05 Hairetsu
Ohp Seijoen H20 05 HairetsuOhp Seijoen H20 05 Hairetsu
Ohp Seijoen H20 05 Hairetsu
 
PSS
PSSPSS
PSS
 
Now Vila da Penha
Now Vila da PenhaNow Vila da Penha
Now Vila da Penha
 
Vila das Fontes Residencial - Vila da Penha - 55 (21) 99219-0640 WhatsApp | 7...
Vila das Fontes Residencial - Vila da Penha - 55 (21) 99219-0640 WhatsApp | 7...Vila das Fontes Residencial - Vila da Penha - 55 (21) 99219-0640 WhatsApp | 7...
Vila das Fontes Residencial - Vila da Penha - 55 (21) 99219-0640 WhatsApp | 7...
 
SQL Server Data Synchronization with Office 365
SQL Server Data Synchronization with Office 365SQL Server Data Synchronization with Office 365
SQL Server Data Synchronization with Office 365
 
Terug Naar De Kust Grontmij Juni 2008
Terug Naar De Kust Grontmij Juni 2008Terug Naar De Kust Grontmij Juni 2008
Terug Naar De Kust Grontmij Juni 2008
 
Elegance Freguesia - Comercialização: 55 (21) 99219-0640 WhatsApp ou (21) 781...
Elegance Freguesia - Comercialização: 55 (21) 99219-0640 WhatsApp ou (21) 781...Elegance Freguesia - Comercialização: 55 (21) 99219-0640 WhatsApp ou (21) 781...
Elegance Freguesia - Comercialização: 55 (21) 99219-0640 WhatsApp ou (21) 781...
 
Sql Server Analysis Server SSAS OLAP Integration Office 365
Sql Server Analysis Server SSAS OLAP Integration Office 365Sql Server Analysis Server SSAS OLAP Integration Office 365
Sql Server Analysis Server SSAS OLAP Integration Office 365
 
Resultados del proyecto Valencia SmartCity y retos en el ámbito de la seguridad
Resultados del proyecto Valencia SmartCity y retos en el ámbito de la seguridadResultados del proyecto Valencia SmartCity y retos en el ámbito de la seguridad
Resultados del proyecto Valencia SmartCity y retos en el ámbito de la seguridad
 
To a wild rose - Edward Mac Dowell
To a wild rose -  Edward Mac DowellTo a wild rose -  Edward Mac Dowell
To a wild rose - Edward Mac Dowell
 

Semelhante a PRE: Datamining 2nd R

第2回 基本演算,データ型の基礎,ベクトルの操作方法(解答付き)
第2回 基本演算,データ型の基礎,ベクトルの操作方法(解答付き)第2回 基本演算,データ型の基礎,ベクトルの操作方法(解答付き)
第2回 基本演算,データ型の基礎,ベクトルの操作方法(解答付き)Wataru Shito
 
第2回 基本演算,データ型の基礎,ベクトルの操作方法
第2回 基本演算,データ型の基礎,ベクトルの操作方法第2回 基本演算,データ型の基礎,ベクトルの操作方法
第2回 基本演算,データ型の基礎,ベクトルの操作方法Wataru Shito
 
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...MasanoriSuganuma
 
[1062BPY12001] Data analysis with R / week 2
[1062BPY12001] Data analysis with R / week 2[1062BPY12001] Data analysis with R / week 2
[1062BPY12001] Data analysis with R / week 2Kevin Chun-Hsien Hsu
 
Datamining r 4th
Datamining r 4thDatamining r 4th
Datamining r 4thsesejun
 
Datastructure tree
Datastructure treeDatastructure tree
Datastructure treerantd
 
R Matrix Math Quick Reference
R Matrix Math Quick ReferenceR Matrix Math Quick Reference
R Matrix Math Quick ReferenceMark Niemann-Ross
 
Useful javascript
Useful javascriptUseful javascript
Useful javascriptLei Kang
 
RではじめるTwitter解析
RではじめるTwitter解析RではじめるTwitter解析
RではじめるTwitter解析Takeshi Arabiki
 
Extending Operators in Perl with Operator::Util
Extending Operators in Perl with Operator::UtilExtending Operators in Perl with Operator::Util
Extending Operators in Perl with Operator::UtilNova Patch
 
Data Munging in R - Chicago R User Group
Data Munging in R - Chicago R User GroupData Munging in R - Chicago R User Group
Data Munging in R - Chicago R User Groupdesignandanalytics
 
Basic operations by novi reandy sasmita
Basic operations by novi reandy sasmitaBasic operations by novi reandy sasmita
Basic operations by novi reandy sasmitabeasiswa
 
Intoduction to numpy
Intoduction to numpyIntoduction to numpy
Intoduction to numpyFaraz Ahmed
 
Factoring common monomial
Factoring common monomialFactoring common monomial
Factoring common monomialAjayQuines
 
Hiroaki Shiokawa
Hiroaki ShiokawaHiroaki Shiokawa
Hiroaki ShiokawaSuurist
 

Semelhante a PRE: Datamining 2nd R (20)

第2回 基本演算,データ型の基礎,ベクトルの操作方法(解答付き)
第2回 基本演算,データ型の基礎,ベクトルの操作方法(解答付き)第2回 基本演算,データ型の基礎,ベクトルの操作方法(解答付き)
第2回 基本演算,データ型の基礎,ベクトルの操作方法(解答付き)
 
第2回 基本演算,データ型の基礎,ベクトルの操作方法
第2回 基本演算,データ型の基礎,ベクトルの操作方法第2回 基本演算,データ型の基礎,ベクトルの操作方法
第2回 基本演算,データ型の基礎,ベクトルの操作方法
 
R programming language
R programming languageR programming language
R programming language
 
MATLAB ARRAYS
MATLAB ARRAYSMATLAB ARRAYS
MATLAB ARRAYS
 
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...
 
[1062BPY12001] Data analysis with R / week 2
[1062BPY12001] Data analysis with R / week 2[1062BPY12001] Data analysis with R / week 2
[1062BPY12001] Data analysis with R / week 2
 
Datamining r 4th
Datamining r 4thDatamining r 4th
Datamining r 4th
 
Slides ads ia
Slides ads iaSlides ads ia
Slides ads ia
 
IA-advanced-R
IA-advanced-RIA-advanced-R
IA-advanced-R
 
Datastructure tree
Datastructure treeDatastructure tree
Datastructure tree
 
R Matrix Math Quick Reference
R Matrix Math Quick ReferenceR Matrix Math Quick Reference
R Matrix Math Quick Reference
 
Useful javascript
Useful javascriptUseful javascript
Useful javascript
 
RではじめるTwitter解析
RではじめるTwitter解析RではじめるTwitter解析
RではじめるTwitter解析
 
Extending Operators in Perl with Operator::Util
Extending Operators in Perl with Operator::UtilExtending Operators in Perl with Operator::Util
Extending Operators in Perl with Operator::Util
 
Data Munging in R - Chicago R User Group
Data Munging in R - Chicago R User GroupData Munging in R - Chicago R User Group
Data Munging in R - Chicago R User Group
 
Basic operations by novi reandy sasmita
Basic operations by novi reandy sasmitaBasic operations by novi reandy sasmita
Basic operations by novi reandy sasmita
 
Intoduction to numpy
Intoduction to numpyIntoduction to numpy
Intoduction to numpy
 
Factoring common monomial
Factoring common monomialFactoring common monomial
Factoring common monomial
 
Lec38
Lec38Lec38
Lec38
 
Hiroaki Shiokawa
Hiroaki ShiokawaHiroaki Shiokawa
Hiroaki Shiokawa
 

Mais de sesejun

RNAseqによる変動遺伝子抽出の統計: A Review
RNAseqによる変動遺伝子抽出の統計: A ReviewRNAseqによる変動遺伝子抽出の統計: A Review
RNAseqによる変動遺伝子抽出の統計: A Reviewsesejun
 
バイオインフォマティクスによる遺伝子発現解析
バイオインフォマティクスによる遺伝子発現解析バイオインフォマティクスによる遺伝子発現解析
バイオインフォマティクスによる遺伝子発現解析sesejun
 
次世代シーケンサが求める機械学習
次世代シーケンサが求める機械学習次世代シーケンサが求める機械学習
次世代シーケンサが求める機械学習sesejun
 
20110602labseminar pub
20110602labseminar pub20110602labseminar pub
20110602labseminar pubsesejun
 
20110524zurichngs 2nd pub
20110524zurichngs 2nd pub20110524zurichngs 2nd pub
20110524zurichngs 2nd pubsesejun
 
20110524zurichngs 1st pub
20110524zurichngs 1st pub20110524zurichngs 1st pub
20110524zurichngs 1st pubsesejun
 
20110214nips2010 read
20110214nips2010 read20110214nips2010 read
20110214nips2010 readsesejun
 
Datamining 9th association_rule.key
Datamining 9th association_rule.keyDatamining 9th association_rule.key
Datamining 9th association_rule.keysesejun
 
Datamining 8th hclustering
Datamining 8th hclusteringDatamining 8th hclustering
Datamining 8th hclusteringsesejun
 
Datamining r 3rd
Datamining r 3rdDatamining r 3rd
Datamining r 3rdsesejun
 
Datamining r 2nd
Datamining r 2ndDatamining r 2nd
Datamining r 2ndsesejun
 
Datamining 6th svm
Datamining 6th svmDatamining 6th svm
Datamining 6th svmsesejun
 
Datamining 5th knn
Datamining 5th knnDatamining 5th knn
Datamining 5th knnsesejun
 
Datamining 4th adaboost
Datamining 4th adaboostDatamining 4th adaboost
Datamining 4th adaboostsesejun
 
Datamining 3rd naivebayes
Datamining 3rd naivebayesDatamining 3rd naivebayes
Datamining 3rd naivebayessesejun
 
Datamining 2nd decisiontree
Datamining 2nd decisiontreeDatamining 2nd decisiontree
Datamining 2nd decisiontreesesejun
 
Datamining 7th kmeans
Datamining 7th kmeansDatamining 7th kmeans
Datamining 7th kmeanssesejun
 
100401 Bioinfoinfra
100401 Bioinfoinfra100401 Bioinfoinfra
100401 Bioinfoinfrasesejun
 
Datamining 8th Hclustering
Datamining 8th HclusteringDatamining 8th Hclustering
Datamining 8th Hclusteringsesejun
 
Datamining 9th Association Rule
Datamining 9th Association RuleDatamining 9th Association Rule
Datamining 9th Association Rulesesejun
 

Mais de sesejun (20)

RNAseqによる変動遺伝子抽出の統計: A Review
RNAseqによる変動遺伝子抽出の統計: A ReviewRNAseqによる変動遺伝子抽出の統計: A Review
RNAseqによる変動遺伝子抽出の統計: A Review
 
バイオインフォマティクスによる遺伝子発現解析
バイオインフォマティクスによる遺伝子発現解析バイオインフォマティクスによる遺伝子発現解析
バイオインフォマティクスによる遺伝子発現解析
 
次世代シーケンサが求める機械学習
次世代シーケンサが求める機械学習次世代シーケンサが求める機械学習
次世代シーケンサが求める機械学習
 
20110602labseminar pub
20110602labseminar pub20110602labseminar pub
20110602labseminar pub
 
20110524zurichngs 2nd pub
20110524zurichngs 2nd pub20110524zurichngs 2nd pub
20110524zurichngs 2nd pub
 
20110524zurichngs 1st pub
20110524zurichngs 1st pub20110524zurichngs 1st pub
20110524zurichngs 1st pub
 
20110214nips2010 read
20110214nips2010 read20110214nips2010 read
20110214nips2010 read
 
Datamining 9th association_rule.key
Datamining 9th association_rule.keyDatamining 9th association_rule.key
Datamining 9th association_rule.key
 
Datamining 8th hclustering
Datamining 8th hclusteringDatamining 8th hclustering
Datamining 8th hclustering
 
Datamining r 3rd
Datamining r 3rdDatamining r 3rd
Datamining r 3rd
 
Datamining r 2nd
Datamining r 2ndDatamining r 2nd
Datamining r 2nd
 
Datamining 6th svm
Datamining 6th svmDatamining 6th svm
Datamining 6th svm
 
Datamining 5th knn
Datamining 5th knnDatamining 5th knn
Datamining 5th knn
 
Datamining 4th adaboost
Datamining 4th adaboostDatamining 4th adaboost
Datamining 4th adaboost
 
Datamining 3rd naivebayes
Datamining 3rd naivebayesDatamining 3rd naivebayes
Datamining 3rd naivebayes
 
Datamining 2nd decisiontree
Datamining 2nd decisiontreeDatamining 2nd decisiontree
Datamining 2nd decisiontree
 
Datamining 7th kmeans
Datamining 7th kmeansDatamining 7th kmeans
Datamining 7th kmeans
 
100401 Bioinfoinfra
100401 Bioinfoinfra100401 Bioinfoinfra
100401 Bioinfoinfra
 
Datamining 8th Hclustering
Datamining 8th HclusteringDatamining 8th Hclustering
Datamining 8th Hclustering
 
Datamining 9th Association Rule
Datamining 9th Association RuleDatamining 9th Association Rule
Datamining 9th Association Rule
 

Último

Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Último (20)

Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

PRE: Datamining 2nd R

  • 2. R • http://r-project.org/ DL • Mac, Win, Linux • S-Plus • • Interactive shell • • :)
  • 3. Applications R • Version 2.6 ( ) • R project DL • 1+1[RET] > 1+1 > 8/3 [1] 2 [1] 2.666667 > 3*6 > as.integer(8/3) [1] 18 [1] 2 > 3^3 > 8%%3 [1] 27 [1] 2
  • 4. & > c(1,2,3) [1] 1 2 3 > x <- 2 > c(1,2,3) + c(4,5,6) > y <- 3 [1] 5 7 9 > x*y > c(1,2,3) * c(4,5,6) [1] 6 [1] 4 10 18 > x^y [1] 8 > c(1,2,3) * 2 [1] 2 4 6 > c(1,2,3) / 2 [1] 0.5 1.0 1.5 > v <- c(1,2,3) > w <- v + 3 > w [1] 4 5 6 > v*w [1] 4 10 18
  • 5. > v <- c(3,2,5,7,2,4,3,1,4) > length(v) [1] 9 > max(v) [1] 7 > min(v) [1] 1 > mean(v) [1] 3.444444 > median(v) [1] 3 > unique(v) [1] 3 2 5 7 4 1 > sort(v) [1] 1 2 2 3 3 4 4 5 7 > order(v) [1] 8 2 5 1 7 6 9 3 4 > hist(v) > help(max)
  • 6. > v <- c(3,2,5,7,2,4,3,1,4) > hist(v, main="My First Histgram", col="gray") > hist(v, col="gray", main="My First Histgram") > w <- sort(v) > plot(v,w) > plot(w,v)
  • 7. > seq(1,4) [1] 1 2 3 4 > 1:4 [1] 1 2 3 4 > seq(1,5,by=2) [1] 1 3 5 > rep(1,4) [1] 1 1 1 1 > rep(1:3,2) [1] 1 2 3 1 2 3 > v <- c(3,2,5,7,2,4,3,1,4) > v[1] [1] 3 > v[c(1,3,5)] [1] 3 5 2 > v[c(5,3,1)] [1] 2 5 3 > v[c(F,F,T,T,F,F,T,T,F)] [1] 5 7 3 1
  • 8. > x <- 3 > x [1] 3 > x == 3 [1] TRUE > x == 5 [1] FALSE > x < 5 [1] TRUE > v <- c(3,2,5,7,2,4,3,1,4) > v == c(3,3,3,3,3,3,3,3,3) [1] TRUE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE > v == 3 [1] TRUE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE > v < 3 [1] FALSE TRUE FALSE FALSE TRUE FALSE FALSE TRUE FALSE
  • 9. > v <- c(3,2,5,7,2,4,3,1,4) > v < 3 [1] FALSE TRUE FALSE FALSE TRUE FALSE FALSE TRUE FALSE > v[v<3] [1] 2 2 1 > v[v>3] [1] 5 7 4 4 > v[v>3 & v<7] [1] 5 4 4 > (1:length(v))[v<3] [1] 2 5 8 > sum(v>3) [1] 4 > v %in% c(2,3,4) [1] TRUE TRUE FALSE FALSE TRUE TRUE TRUE FALSE TRUE > v[v %in% c(2,3,4)] [1] 3 2 2 4 3 4
  • 10. > runif(10,min=0,max=1) [1] 0.45189074 0.15543373 0.04654874 0.56946222 0.06086409 [6] 0.64340708 0.91820279 0.28365751 0.91056890 0.61600679 > n <- 10 > hist(runif(n,min=0,max=1), main=paste("n=",n,sep="")) > n <- 10000 > hist(runif(n,min=0,max=1), main=paste("n=",n,sep=""))
  • 11. . > n <- 10 > x <- runif(n,min=0,max=1) > x [1] 0.9308879 0.6457174 0.7480667 0.9277555 0.2432229 0.7852049 [7] 0.9005295 0.3948717 0.3442392 0.7808671 > x < 0.3 [1] FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE > sum(x < 0.3) [1] 1 > sum(x < 0.3)/n [1] 0.1 > n <- 10000 > x <- runif(n,min=0,max=1) > sum(x < 0.3)/n [1] 0.3013 > n <- 10000 > x <- rnorm(n,mean=0,sd=1) > sum(x < 0.3)/n [1] 0.6125 > sum(x > 1.0)/n [1] 0.1591
  • 12. > m <- matrix((1:9)**2,nrow=3) > m [,1] [,2] [,3] [1,] 1 16 49 [2,] 4 25 64 [3,] 9 36 81 > m[c(2,3),c(2,3)] [,1] [,2] [1,] 25 64 [2,] 36 81 > m[2,] [1] 4 25 64 > m[c(1,2),] [,1] [,2] [,3] [1,] 1 16 49 [2,] 4 25 64 > m[,2] [1] 16 25 36 > m<50 [,1] [,2] [,3] [1,] TRUE TRUE TRUE [2,] TRUE TRUE FALSE [3,] TRUE TRUE FALSE
  • 13. > m <- matrix((1:9)**2,nrow=3) > solve(m) [,1] [,2] [,3] [1,] 1.291667 -2.166667 0.9305556 [2,] -1.166667 1.666667 -0.6111111 [3,] 0.375000 -0.500000 0.1805556 > eigen(m) $values [1] 112.9839325 -6.2879696 0.3040371 $vectors [,1] [,2] [,3] [1,] -0.3993327 -0.8494260 0.7612507 [2,] -0.5511074 -0.4511993 -0.6195403 [3,] -0.7326760 0.2736690 0.1914866 > v <- c(3,2,5,7,2,4,3,1,4) > t(v) %*% v [,1] [1,] 133
  • 14. R • R ≠ • • if for • R • • apply family ( R apply, sapply, lapply ) • •
  • 15. R WEB • R-Tips: • http://cse.naro.affrc.go.jp/takezawa/r-tips/r.html • RjpWiki • http://www.okada.jp.org/RWiki/ • R