| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/bk_method.R |
| 3 |
\name{sort_2_clusters_vectors} |
| 4 |
\alias{sort_2_clusters_vectors} |
| 5 |
\title{Sorts two clusters vector by their names} |
| 6 |
\usage{ |
| 7 |
sort_2_clusters_vectors( |
| 8 |
A1_clusters, |
| 9 |
A2_clusters, |
| 10 |
assume_sorted_vectors = FALSE, |
| 11 |
warn = dendextend_options("warn"), |
| 12 |
... |
| 13 |
) |
| 14 |
} |
| 15 |
\arguments{ |
| 16 |
\item{A1_clusters}{a numeric vector of cluster grouping (numeric) of items, |
| 17 |
with a name attribute of item name for each element from group A1. |
| 18 |
These are often obtained by using some k cut on a dendrogram.} |
| 19 |
|
| 20 |
\item{A2_clusters}{a numeric vector of cluster grouping (numeric) of items, |
| 21 |
with a name attribute of item name for each element from group A2. |
| 22 |
These are often obtained by using some k cut on a dendrogram.} |
| 23 |
|
| 24 |
\item{assume_sorted_vectors}{logical (FALSE). Can we assume to two group |
| 25 |
vectors are sorter so that they have the same order of items? |
| 26 |
IF FALSE (default), then the vectors will be sorted based on their |
| 27 |
name attribute.} |
| 28 |
|
| 29 |
\item{warn}{logical (default from dendextend_options("warn") is FALSE). |
| 30 |
Set if warning are to be issued, it is safer to keep this at TRUE, |
| 31 |
but for keeping the noise down, the default is FALSE.} |
| 32 |
|
| 33 |
\item{...}{Ignored.} |
| 34 |
} |
| 35 |
\value{ |
| 36 |
A list with two elements, corresponding to the two clustering vectors. |
| 37 |
} |
| 38 |
\description{ |
| 39 |
Sorts two clusters vector by their names and returns a list with the sorted vectors. |
| 40 |
} |
| 41 |
\examples{ |
| 42 |
|
| 43 |
\dontrun{ |
| 44 |
|
| 45 |
set.seed(23235) |
| 46 |
ss <- sample(1:150, 4) |
| 47 |
hc1 <- hclust(dist(iris[ss, -5]), "com") |
| 48 |
hc2 <- hclust(dist(iris[ss, -5]), "single") |
| 49 |
# dend1 <- as.dendrogram(hc1) |
| 50 |
# dend2 <- as.dendrogram(hc2) |
| 51 |
# cutree(dend1) |
| 52 |
|
| 53 |
A1_clusters <- cutree(hc1, k = 3) |
| 54 |
A2_clusters <- sample(cutree(hc1, k = 3)) |
| 55 |
|
| 56 |
sort_2_clusters_vectors(A1_clusters, A2_clusters, assume_sorted_vectors = TRUE) # no sorting |
| 57 |
sort_2_clusters_vectors(A1_clusters, A2_clusters, assume_sorted_vectors = FALSE) # Sorted |
| 58 |
} |
| 59 |
} |