# NOT RUN {
x <- 1:5 %>%
dist() %>%
hclust() %>%
as.dendrogram()
y <- set(x, "labels", 5:1)
distinct_edges(x, y)
distinct_edges(y, x)
par(mfrow = c(1, 2))
plot(highlight_distinct_edges(x, y))
plot(y)
# tanglegram(highlight_distinct_edges(x, y),y)
# dend_diff(x, y)
# }
# NOT RUN {
# using highlight_distinct_edges combined with dendlist and set
# to clearly highlight "stable" branches.
data(iris)
ss <- c(1:5, 51:55, 101:105)
iris1 <- iris[ss, -5] %>%
dist() %>%
hclust(method = "single") %>%
as.dendrogram()
iris2 <- iris[ss, -5] %>%
dist() %>%
hclust(method = "complete") %>%
as.dendrogram()
iris12 <- dendlist(iris1, iris2) %>%
set("branches_k_color", k = 3) %>%
set("branches_lwd", 3) %>%
highlight_distinct_edges(value = 1, edgePar = "lwd")
iris12 %>%
untangle(method = "step2side") %>%
tanglegram(
sub = "Iris dataset", main_left = "'single' clustering",
main_right = "'complete' clustering"
)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab