View source: R/craft-align-order2.R
align_order2 | R Documentation |
Reorders layout observations based on specific statistics.
align_order2(
stat,
...,
reverse = FALSE,
strict = TRUE,
data = NULL,
active = NULL
)
stat |
A statistical function which accepts a data and returns the
statistic, which we'll call |
... |
<dyn-dots> Additional arguments passed to
function provided in |
reverse |
A boolean value. Should the sort order be in reverse? |
strict |
A boolean value indicates whether the order should be strict.
If previous groups has been established, and strict is |
data |
A |
active |
A |
The align_order2()
function differs from align_order()
in that the
weights
argument in align_order()
must return atomic weights for each
observation. In contrast, the stat
argument in align_order2()
can
return more complex structures, such as hclust or
dendrogram, among others.
Typically, you can achieve the functionality of align_order2()
using
align_order()
by manually extracting the ordering information from
the statistic.
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).
order2()
ggheatmap(matrix(rnorm(81), nrow = 9)) +
anno_left() +
align_order2(hclust2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.