| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/noded_with_condition.R |
| 3 |
\name{which_node} |
| 4 |
\alias{which_node} |
| 5 |
\title{Which node id is common to a group of labels} |
| 6 |
\usage{ |
| 7 |
which_node(dend, labels, max_id = TRUE, ...) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{dend}{a dendrogram dend} |
| 11 |
|
| 12 |
\item{labels}{a character vector of labels from the tree} |
| 13 |
|
| 14 |
\item{max_id}{logical (TRUE) - if to return only the max id} |
| 15 |
|
| 16 |
\item{...}{ignored.} |
| 17 |
} |
| 18 |
\value{ |
| 19 |
An integer with the id(s) of the nodes which includes all of the labels. |
| 20 |
} |
| 21 |
\description{ |
| 22 |
This function identifies which edge(s) in a tree has group of labels ("tips") in common. |
| 23 |
By default it only returns the edge (node) with the heighest id. |
| 24 |
} |
| 25 |
\examples{ |
| 26 |
|
| 27 |
dend <- iris[1:10, -5] \%>\% |
| 28 |
dist() \%>\% |
| 29 |
hclust() \%>\% |
| 30 |
as.dendrogram() \%>\% |
| 31 |
set("labels", 1:10) |
| 32 |
dend \%>\% plot() |
| 33 |
|
| 34 |
which_node(dend, c(1, 2), max_id = FALSE) |
| 35 |
which_node(dend, c(2, 3), max_id = FALSE) |
| 36 |
which_node(dend, c(2, 3)) |
| 37 |
|
| 38 |
dend \%>\% plot() |
| 39 |
the_h <- get_nodes_attr(dend, "height", which_node(dend, c(4, 6))) |
| 40 |
the_h |
| 41 |
abline(h = the_h, lty = 2, col = 2) |
| 42 |
get_nodes_attr(dend, "height", which_node(dend, c(4, 6))) |
| 43 |
get_nodes_attr(dend, "members", which_node(dend, c(4, 6))) |
| 44 |
} |
| 45 |
\seealso{ |
| 46 |
\link{noded_with_condition}, \link{branches_attr_by_clusters}, |
| 47 |
\link{nnodes}, \link{branches_attr_by_labels}, \link{get_nodes_attr} |
| 48 |
\link[ape]{which.edge} |
| 49 |
} |