Debian Codegraph @

man/match_order_by_labels.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/entanglement.R
3 \name{match_order_by_labels}
4 \alias{match_order_by_labels}
5 \title{Adjust the order of one dendrogram based on another (using labels)}
6 \usage{
7 match_order_by_labels(
8 dend_change,
9 dend_template,
10 check_that_labels_match = TRUE
11 )
12 }
13 \arguments{
14 \item{dend_change}{tree object (dendrogram)}
15
16 \item{dend_template}{tree object (dendrogram)}
17
18 \item{check_that_labels_match}{logical (TRUE). If to check that the labels
19 in the two dendrogram match. (if they do not, the function aborts)}
20 }
21 \value{
22 Returns dend_change after adjusting its order values to
23 be like dend_template.
24 }
25 \description{
26 Takes one dendrogram and adjusts its order leaves valeus based on the order
27 of another dendrogram. The values are matached based on the labels of the
28 two dendrograms.
29
30 This allows for faster \link{entanglement} running time, since we can be
31 sure that the leaves order is just as using their labels.
32 }
33 \examples{
34 \dontrun{
35
36 dend <- USArrests[1:4, ] \%>\%
37 dist() \%>\%
38 hclust() \%>\%
39 as.dendrogram()
40 order.dendrogram(dend) # c(4L, 3L, 1L, 2L)
41
42 dend_changed <- dend
43 order.dendrogram(dend_changed) <- 1:4
44 order.dendrogram(dend_changed) # c(1:4)
45
46 # now let's fix the order of the new object to be as it was:
47 dend_changed <- match_order_by_labels(dend_changed, dend)
48 # these two are now the same:
49 order.dendrogram(dend_changed)
50 order.dendrogram(dend)
51 }
52 }
53 \seealso{
54 \link{entanglement} , \link{tanglegram}
55 }