| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/prune.R |
| 3 |
\name{intersect_trees} |
| 4 |
\alias{intersect_trees} |
| 5 |
\title{Intersect trees} |
| 6 |
\usage{ |
| 7 |
intersect_trees(dend1, dend2, warn = dendextend_options("warn"), ...) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{dend1}{tree object (dendrogram/hclust/phylo)} |
| 11 |
|
| 12 |
\item{dend2}{tree object (dendrogram/hclust/phylo)} |
| 13 |
|
| 14 |
\item{warn}{logical (default from dendextend_options("warn") is FALSE). |
| 15 |
Set if warning are to be issued, it is safer to keep this at TRUE, |
| 16 |
but for keeping the noise down, the default is FALSE. |
| 17 |
Should a warning be issued if there was a need to perform intersaction.} |
| 18 |
|
| 19 |
\item{...}{passed on} |
| 20 |
} |
| 21 |
\value{ |
| 22 |
A \link{dendlist} with two pruned trees |
| 23 |
} |
| 24 |
\description{ |
| 25 |
Return two trees after pruning them so that the only leaves left are the intersection of their labels. |
| 26 |
} |
| 27 |
\examples{ |
| 28 |
hc <- hclust(dist(USArrests[1:5, ]), "ave") |
| 29 |
dend <- as.dendrogram(hc) |
| 30 |
labels(dend) <- 1:5 |
| 31 |
dend1 <- prune(dend, 1) |
| 32 |
dend2 <- prune(dend, 5) |
| 33 |
intersect_dend <- intersect_trees(dend1, dend2) |
| 34 |
|
| 35 |
layout(matrix(c(1, 1, 2, 3, 4, 5), 3, 2, byrow = TRUE)) |
| 36 |
plot(dend, main = "Original tree") |
| 37 |
plot(dend1, main = "Tree 1:\n original with label 1 pruned") |
| 38 |
plot(dend2, main = "Tree 2:\n original with label 2 pruned") |
| 39 |
plot(intersect_dend[[1]], |
| 40 |
main = "Tree 1 pruned |
| 41 |
with the labels that intersected with those of Tree 2" |
| 42 |
) |
| 43 |
plot(intersect_dend[[2]], |
| 44 |
main = "Tree 2 pruned |
| 45 |
with the labels that intersected with those of Tree 1" |
| 46 |
) |
| 47 |
} |
| 48 |
\seealso{ |
| 49 |
\link{prune}, \link{intersect}, \link{labels} |
| 50 |
} |