R dist()

Jmnote (토론 | 기여)님의 2019년 5월 11일 (토) 11:30 판 (새 문서: ==개요== ;R dist() * "Distance Matrix Computation" <source lang='r'> x <- matrix(rnorm(20), nrow=4) x ## [,1] [,2] [,3] [,4] [,5] ## [1,] 1.370...)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요

R dist()
  • "Distance Matrix Computation"
x <- matrix(rnorm(20), nrow=4)
x
##            [,1]        [,2]       [,3]       [,4]       [,5]
## [1,]  1.3709584  0.40426832  2.0184237 -1.3888607 -0.2842529
## [2,] -0.5646982 -0.10612452 -0.0627141 -0.2787888 -2.6564554
## [3,]  0.3631284  1.51152200  1.3048697 -0.1333213 -2.4404669
## [4,]  0.6328626 -0.09465904  2.2866454  0.6359504  1.3201133
dist(x)
##          1        2        3
## 2 3.898462                  
## 3 2.996086 2.327174         
## 4 2.745816 4.858356 4.283713
dist(x, diag = TRUE)
##          1        2        3        4
## 1 0.000000                           
## 2 3.898462 0.000000                  
## 3 2.996086 2.327174 0.000000         
## 4 2.745816 4.858356 4.283713 0.000000
dist(x, upper = TRUE)
##          1        2        3        4
## 1          3.898462 2.996086 2.745816
## 2 3.898462          2.327174 4.858356
## 3 2.996086 2.327174          4.283713
## 4 2.745816 4.858356 4.283713

2 같이 보기

3 참고

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}