| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/attr_access.R |
| 3 |
\name{rank_branches} |
| 4 |
\alias{rank_branches} |
| 5 |
\title{Rank branches' heights} |
| 6 |
\usage{ |
| 7 |
rank_branches(dend, diff_height = 1, ...) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{dend}{a dendrogram object} |
| 11 |
|
| 12 |
\item{diff_height}{Numeric scalar (1). Affects the difference in height |
| 13 |
between two branches.} |
| 14 |
|
| 15 |
\item{...}{not used} |
| 16 |
} |
| 17 |
\value{ |
| 18 |
A dendrogram, after adjusting the height attr in all of its branches. |
| 19 |
} |
| 20 |
\description{ |
| 21 |
Adjust the height attr in all of the dendrogram nodes so that |
| 22 |
the tree will have a distance of 1 unit between each parent/child nodes. |
| 23 |
It can be thought of as ranking the branches between themselves. |
| 24 |
|
| 25 |
This is intended for easier comparison of the topology of two trees. |
| 26 |
|
| 27 |
Notice that this function changes the height of all the leaves into 0, |
| 28 |
thus erasing the effect of \link{hang.dendrogram} (which should be run |
| 29 |
again, if that is the visualization you are intereted in). |
| 30 |
} |
| 31 |
\examples{ |
| 32 |
|
| 33 |
# define dendrogram object to play with: |
| 34 |
dend <- USArrests[1:5, ] \%>\% |
| 35 |
dist() \%>\% |
| 36 |
hclust() \%>\% |
| 37 |
as.dendrogram() |
| 38 |
|
| 39 |
par(mfrow = c(1, 3)) |
| 40 |
|
| 41 |
plot(dend) |
| 42 |
plot(rank_branches(dend)) |
| 43 |
plot(hang.dendrogram(rank_branches(dend))) |
| 44 |
} |
| 45 |
\seealso{ |
| 46 |
\link{get_branches_heights}, \link{get_childrens_heights}, |
| 47 |
\link{hang.dendrogram}, \link{tanglegram} |
| 48 |
} |