top of page

> seiseki <- read.csv("Cluster.csv")
> seiseki
          X Math Sci Japan Eng Social
1   Tanaka   89  90    67  46     50
2     Sato   57  70    80  85     90
3   Suzuki   80  90    35  40     50
4    Honda   40  60    50  45     55
5 Kawabata   78  85    45  55     60
6  Yoshino   55  65    80  75     85
7    Saito   90  85    88  92     95
>
> seiseki.d<- dist(seiseki)
 警告メッセージ: 
 dist(seiseki) で:   強制変換により NA が生成されました 
> round(seiseki.d)
    1   2   3   4   5   6
2  75                    
3  37  89                
4  66  70  58            
5  31  67  23  52        
6  69  14  83  59  62    
7  74  42  96 100  74  50


> sei.d<-dist(seiseki)
 警告メッセージ: 
 dist(seiseki) で:   強制変換により NA が生成されました 
> sei.hc<-hclust(sei.d)
>  (sei.hc<-hclust(sei.d))


Call:
hclust(d = sei.d)

Cluster method   : complete 
Distance         : euclidean 
Number of objects: 7 

> summary(sei.hc)
            Length Class  Mode     
merge       12     -none- numeric  
height       6     -none- numeric  
order        7     -none- numeric  
labels       0     -none- NULL     
method       1     -none- character
call         2     -none- call     
dist.method  1     -none- character
> sei.hc$merge
     [,1] [,2]
[1,]   -2   -6
[2,]   -3   -5
[3,]   -1    2
[4,]   -7    1
[5,]   -4    3
[6,]    4    5
> sei.hc$height
[1]  13.59412  23.34095  37.00270  49.93596  65.87260 100.26764
> sei.hc$order
[1] 7 2 6 4 1 3 5
> par(mfrow=c(2,2))
> plot(sei.hc,main="Complete") 
> s.hc3<-hclust(sei.d,method="ward.D")
> plot(s.hc3,hang=-1,main="Ward")

© 2018-2024 HIDEYUKI UNUMA

All visitors since 14 Apr. 2018

  • Twitter
  • Instagram
  • Facebook
bottom of page