-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdendrogram.R
More file actions
50 lines (23 loc) · 729 Bytes
/
dendrogram.R
File metadata and controls
50 lines (23 loc) · 729 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# DENDROGRAM
# REQUIREMENTS
# dataframe - individuals in row, features in column
# dist() - computes distance between sample
# hclust() - hierarchical clustering
# plot() -
library(tidyverse)
# basic dendrogram
vorta = matrix( sample(seq(1,2000), 200), ncol= 10)
rownames(vorta) = paste0("clone_", seq(1,20))
colnames(vorta) = paste0("iteration_", seq(1,10))
vorta %>% view()
dist = dist(vorta[ , c(4:8)], diag = T)
dist
h_clust = hclust(dist)
plot(h_clust, main = "Dominion Vorta Cloning Hierarchical Clustering")
dend = mtcars %>%
select(mpg, cyl, disp) %>%
dist() %>%
hclust() %>%
as.dendrogram()
par(mar=c(7,3,1,1)) # Increase bottom margin to have the complete label
plot(dend)