View source: R/craft-align-hclust.R
align_hclust | R Documentation |
This function aligns observations within the layout according to a hierarchical clustering tree, enabling reordering or grouping of elements based on clustering results.
align_hclust(
distance = "euclidean",
method = "complete",
use_missing = "pairwise.complete.obs",
reorder_dendrogram = FALSE,
reorder_group = FALSE,
k = NULL,
h = NULL,
cutree = NULL,
data = NULL,
active = NULL
)
distance |
A string of distance measure to be used. This must be one of
|
method |
A string of the agglomeration method to be used. This should be
(an unambiguous abbreviation of) one of |
use_missing |
An optional character string giving a method for computing
covariances in the presence of missing values. This must be (an abbreviation
of) one of the strings |
reorder_dendrogram |
A single boolean value indicating whether to
reorder the dendrogram based on the means. Alternatively, you can provide a
custom function that accepts an |
reorder_group |
A single boolean value, indicates whether we should do
Hierarchical Clustering between groups, only used when previous groups have
been established. Default: |
k |
An integer scalar indicates the desired number of groups. |
h |
A numeric scalar indicates heights where the tree should be cut. |
cutree |
A function used to cut the |
data |
A matrix-like object. By default, it inherits from the layout
|
active |
A |
It is important to note that we consider rows as observations, meaning
vec_size(data)
/NROW(data)
must match the number of observations along the
axis used for alignment (x-axis for a vertical stack layout, y-axis for a
horizontal stack layout).
hclust2()
# align_hclust won't add a dendrogram
ggheatmap(matrix(rnorm(81), nrow = 9)) +
anno_top() +
align_hclust(k = 3L)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.