File: which_node.Rd

package info (click to toggle)
r-cran-dendextend 1.14.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,888 kB
  • sloc: sh: 13; makefile: 2
file content (49 lines) | stat: -rw-r--r-- 1,349 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/noded_with_condition.R
\name{which_node}
\alias{which_node}
\title{Which node id is common to a group of labels}
\usage{
which_node(dend, labels, max_id = TRUE, ...)
}
\arguments{
\item{dend}{a dendrogram dend}

\item{labels}{a character vector of labels from the tree}

\item{max_id}{logical (TRUE) - if to return only the max id}

\item{...}{ignored.}
}
\value{
An integer with the id(s) of the nodes which includes all of the labels.
}
\description{
This function identifies which edge(s) in a tree has group of labels ("tips") in common.
By default it only returns the edge (node) with the heighest id.
}
\examples{

dend <- iris[1:10, -5] \%>\%
  dist() \%>\%
  hclust() \%>\%
  as.dendrogram() \%>\%
  set("labels", 1:10)
dend \%>\% plot()

which_node(dend, c(1, 2), max_id = FALSE)
which_node(dend, c(2, 3), max_id = FALSE)
which_node(dend, c(2, 3))

dend \%>\% plot()
the_h <- get_nodes_attr(dend, "height", which_node(dend, c(4, 6)))
the_h
abline(h = the_h, lty = 2, col = 2)
get_nodes_attr(dend, "height", which_node(dend, c(4, 6)))
get_nodes_attr(dend, "members", which_node(dend, c(4, 6)))
}
\seealso{
\link{noded_with_condition}, \link{branches_attr_by_clusters},
\link{nnodes}, \link{branches_attr_by_labels}, \link{get_nodes_attr}
\link[ape]{which.edge}
}