Plots two trees side by side, highlighting edges unique to each tree in red.

dend_diff(dend, ...)

# S3 method for class 'dendrogram'
dend_diff(dend, dend2, horiz = TRUE, ...)

# S3 method for class 'dendlist'
dend_diff(dend, ..., which = c(1L, 2L))

Source

A dendrogram implementation for phylo.diff from the distory package

Arguments

dend

a dendrogram or dendlist to compre with

...

passed to plot.dendrogram

dend2

a dendrogram to compare with

horiz

logical (TRUE) indicating if the dendrogram should be drawn horizontally or not.

which

an integer vector indicating, in the case "dend" is a dendlist, on which of the trees should the modification be performed. If missing - the change will be performed on all of objects in the dendlist.

Value

Invisible dendlist of both trees.

Examples


x <- 1:5 %>%
  dist() %>%
  hclust() %>%
  as.dendrogram()
y <- set(x, "labels", 5:1)

dend_diff(x, y)
dend_diff(dendlist(x, y))

dend_diff(dendlist(y, x))


dend1 <- 1:10 %>%
  dist() %>%
  hclust() %>%
  as.dendrogram()
dend2 <- dend1 %>% set("labels", c(1, 3, 2, 4, 5:10))
dend_diff(dend1, dend2)