File: shuffle.Rd

package info (click to toggle)
r-cran-dendextend 1.16.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,936 kB
  • sloc: sh: 13; makefile: 2
file content (66 lines) | stat: -rw-r--r-- 1,753 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/untangle.R
\name{shuffle}
\alias{shuffle}
\alias{shuffle.default}
\alias{shuffle.dendrogram}
\alias{shuffle.dendlist}
\alias{shuffle.hclust}
\alias{shuffle.phylo}
\title{Random rotation of trees}
\usage{
shuffle(dend, ...)

\method{shuffle}{default}(dend, ...)

\method{shuffle}{dendrogram}(dend, ...)

\method{shuffle}{dendlist}(dend, which, ...)

\method{shuffle}{hclust}(dend, ...)

\method{shuffle}{phylo}(dend, ...)
}
\arguments{
\item{dend}{a tree object (\link{dendrogram}/\link{hclust}/\link[ape]{phylo})}

\item{...}{Ignored.}

\item{which}{an integer vector for indicating
which of the trees in the dendlist object should be plotted
default is missing, in which case all the dends in dendlist
will be shuffled}
}
\value{
A randomlly rotated tree object
}
\description{
'shuffle' randomilly rotates ("shuffles") a tree, changing its presentation
while preserving its topolgoy.
'shuffle' is based on \link[dendextend]{rotate} and through its methods can
work for any of the major tree objects in R (\link{dendrogram}/\link{hclust}/\link[ape]{phylo}).

This function is useful in combination with \link{tanglegram} and \link{entanglement}.
}
\details{
'shuffle' is a function that randomilly rotates ("shuffles") a tree.
a dendrogram leaves order (by means of rotation)
}
\examples{
dend <- USArrests \%>\%
  dist() \%>\%
  hclust() \%>\%
  as.dendrogram()
set.seed(234238)
dend2 <- shuffle(dend)

tanglegram(dend, dend2, margin_inner = 7)
entanglement(dend, dend2) # 0.3983

# although these ARE the SAME tree:
tanglegram(sort(dend), sort(dend2), margin_inner = 7)
}
\seealso{
\code{\link{tanglegram}},  \code{\link{entanglement}},
\code{\link[dendextend]{rotate}}
}