File: branches_attr_by_lists.Rd

package info (click to toggle)
r-cran-dendextend 1.14.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,888 kB
  • sloc: sh: 13; makefile: 2
file content (67 lines) | stat: -rw-r--r-- 1,822 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
67
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/branches_attr_by.R
\name{branches_attr_by_lists}
\alias{branches_attr_by_lists}
\title{Change col/lwd/lty of branches from the root down to clusters defined by list of labels of respective members}
\usage{
branches_attr_by_lists(
  dend,
  lists,
  TF_values = c(2, 1),
  attr = c("col", "lwd", "lty"),
  ...
)
}
\arguments{
\item{dend}{a dendrogram dend}

\item{lists}{a list where each element contains the labels of members in selected nodes
down to which the branches shall be adapted}

\item{TF_values}{a two dimensional vector with the TF_values to use in case a branch fulfills the condition (TRUE)
and in the case that it does not (FALSE). Defaults are 2/1 for col, lwd and lty.
(so it will insert the first value, and will not change all the FALSE cases)}

\item{attr}{a character with one of the following values: col/lwd/lty}

\item{...}{ignored.}
}
\value{
A dendrogram with modified branches (col/lwd/lty).
}
\description{
The user supplies a dend, lists, and type of condition (all/any), and TF_values
And the function returns a dendrogram with branches col/lwd/lty accordingly
}
\examples{
\dontrun{

library(dendextend)

set.seed(23235)
ss <- sample(1:150, 10)

# Getting the dend dend
dend <- iris[ss, -5] \%>\%
  dist() \%>\%
  hclust() \%>\%
  as.dendrogram()
dend \%>\% plot()

# define a list of nodes
L <- list(c("109", "123", "126", "145"), "29", c("59", "67", "97"))
dend \%>\%
  branches_attr_by_lists(L) \%>\%
  plot()

# choose different color, and also change lwd and lty
dend \%>\%
  branches_attr_by_lists(L, TF_value = "blue") \%>\%
  branches_attr_by_lists(L, attr = "lwd", TF_value = 4) \%>\%
  branches_attr_by_lists(L, attr = "lty", TF_value = 3) \%>\%
  plot()
}
}
\seealso{
\link{branches_attr_by_labels}
}