Debian Codegraph @

man/shuffle.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/untangle.R
3 \name{shuffle}
4 \alias{shuffle}
5 \alias{shuffle.default}
6 \alias{shuffle.dendrogram}
7 \alias{shuffle.dendlist}
8 \alias{shuffle.hclust}
9 \alias{shuffle.phylo}
10 \title{Random rotation of trees}
11 \usage{
12 shuffle(dend, ...)
13
14 \method{shuffle}{default}(dend, ...)
15
16 \method{shuffle}{dendrogram}(dend, ...)
17
18 \method{shuffle}{dendlist}(dend, which, ...)
19
20 \method{shuffle}{hclust}(dend, ...)
21
22 \method{shuffle}{phylo}(dend, ...)
23 }
24 \arguments{
25 \item{dend}{a tree object (\link{dendrogram}/\link{hclust}/\link[ape]{phylo})}
26
27 \item{...}{Ignored.}
28
29 \item{which}{an integer vector for indicating
30 which of the trees in the dendlist object should be plotted
31 default is missing, in which case all the dends in dendlist
32 will be shuffled}
33 }
34 \value{
35 A randomlly rotated tree object
36 }
37 \description{
38 'shuffle' randomilly rotates ("shuffles") a tree, changing its presentation
39 while preserving its topolgoy.
40 'shuffle' is based on \link[dendextend]{rotate} and through its methods can
41 work for any of the major tree objects in R (\link{dendrogram}/\link{hclust}/\link[ape]{phylo}).
42
43 This function is useful in combination with \link{tanglegram} and \link{entanglement}.
44 }
45 \details{
46 'shuffle' is a function that randomilly rotates ("shuffles") a tree.
47 a dendrogram leaves order (by means of rotation)
48 }
49 \examples{
50 dend <- USArrests \%>\%
51 dist() \%>\%
52 hclust() \%>\%
53 as.dendrogram()
54 set.seed(234238)
55 dend2 <- shuffle(dend)
56
57 tanglegram(dend, dend2, margin_inner = 7)
58 entanglement(dend, dend2) # 0.3983
59
60 # although these ARE the SAME tree:
61 tanglegram(sort(dend), sort(dend2), margin_inner = 7)
62 }
63 \seealso{
64 \code{\link{tanglegram}}, \code{\link{entanglement}},
65 \code{\link[dendextend]{rotate}}
66 }