Debian Codegraph @

man/collapse_branch.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/unbranch.R
3 \name{collapse_branch}
4 \alias{collapse_branch}
5 \title{Collapse branches under a tolerance level}
6 \usage{
7 collapse_branch(dend, tol = 1e-08, lower = TRUE, ...)
8 }
9 \arguments{
10 \item{dend}{dendrogram object}
11
12 \item{tol}{a numeric value giving the tolerance to consider a branch length significantly greater than zero}
13
14 \item{lower}{logical (TRUE). collapse branches which are lower than tol?}
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 Collapse branches under a tolerance level
23 }
24 \examples{
25
26 # # ladderize is like sort(..., type = "node")
27 dend <- iris[1:5, -5] \%>\%
28 dist() \%>\%
29 hclust() \%>\%
30 as.dendrogram()
31 par(mfrow = c(1, 3))
32 dend \%>\%
33 ladderize() \%>\%
34 plot(horiz = TRUE)
35 abline(v = .2, col = 2, lty = 2)
36 dend \%>\%
37 collapse_branch(tol = 0.2) \%>\%
38 ladderize() \%>\%
39 plot(horiz = TRUE)
40 dend \%>\%
41 collapse_branch(tol = 0.2) \%>\%
42 ladderize() \%>\%
43 hang.dendrogram(hang = 0) \%>\%
44 plot(horiz = TRUE)
45
46 par(mfrow = c(1, 2))
47 dend \%>\%
48 collapse_branch(tol = 0.2, lower = FALSE) \%>\%
49 plot(horiz = TRUE, main = "dendrogram")
50 library(ape)
51 dend \%>\%
52 as.phylo() \%>\%
53 di2multi(tol = 0.2) \%>\%
54 plot(main = "phylo")
55 }
56 \seealso{
57 \link[ape]{multi2di}
58 }