| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/unbranch.R |
| 3 |
\name{flatten.dendrogram} |
| 4 |
\alias{flatten.dendrogram} |
| 5 |
\title{Flatten the branches of a dendrogram's root} |
| 6 |
\usage{ |
| 7 |
flatten.dendrogram(dend, FUN = max, new_height, ...) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{dend}{dendrogram object} |
| 11 |
|
| 12 |
\item{FUN}{how to choose the new height of both branches (defaults to taking the max between the two)} |
| 13 |
|
| 14 |
\item{new_height}{overrides FUN, and sets the new height of the two branches manually} |
| 15 |
|
| 16 |
\item{...}{passed on (not used)} |
| 17 |
} |
| 18 |
\value{ |
| 19 |
A dendrogram with both of the root's branches of the same height |
| 20 |
} |
| 21 |
\description{ |
| 22 |
The function makes sure the two branches of the root of a dendrogram will have the same height. |
| 23 |
The user can choose how to decide which height to use. |
| 24 |
} |
| 25 |
\examples{ |
| 26 |
hc <- hclust(dist(USArrests[2:9, ]), "com") |
| 27 |
dend <- as.dendrogram(hc) |
| 28 |
attr(dend[[1]], "height") <- 150 # make the height un-equal |
| 29 |
|
| 30 |
par(mfrow = c(1, 2)) |
| 31 |
plot(dend, main = "original tree") |
| 32 |
plot(flatten.dendrogram(dend), main = "Raised tree") |
| 33 |
} |