if (FALSE) {
set.seed(23235)
ss <- sample(1:150, 10)
dend1 <- iris[ss, -5] %>%
dist() %>%
hclust("com") %>%
as.dendrogram()
dend2 <- iris[ss, -5] %>%
dist() %>%
hclust("sin") %>%
as.dendrogram()
dend12 <- dendlist(dend1, dend2)
dend12 %>% tanglegram()
untangle(dend1, dend2, method = "random", R = 5) %>% tanglegram()
# it works, and we get something different:
set.seed(1234)
dend12 %>%
untangle(method = "random", R = 5) %>%
tanglegram()
set.seed(1234)
# fixes it completely:
dend12 %>%
untangle(method = "random", R = 5) %>%
untangle(method = "step1") %>%
tanglegram()
# not good enough
dend12 %>%
untangle(method = "step1") %>%
tanglegram()
# not good enough
dend12 %>%
untangle(method = "step2") %>%
tanglegram()
# How we might wish to use it:
set.seed(12777)
dend12 %>%
untangle(method = "random", R = 1) %>%
untangle(method = "step2") %>%
tanglegram()
}
Run the code above in your browser using DataLab