Order layout observations based on weights
align_order(
wts = rowMeans,
...,
reverse = FALSE,
strict = TRUE,
data = NULL,
set_context = FALSE,
name = NULL
)
A new Align
object.
A summary function which accepts a data and returns the weights
for each observations. Alternatively, you can provide an ordering index as
either an integer or a character. Since characters have been designated as
character indices, if you wish to specify a function name as a string, you
must enclose it with I()
.
<dyn-dots> Additional arguments passed to
function provided in wts
argument.
A boolean value. Should the sort order be in reverse?
A boolean value indicates whether the order should be strict.
If previous groups has been established, and strict is FALSE
, this will
reorder the observations in each group.
A matrix, data frame, or a simple vector. If an atomic vector is
provided, it will be converted into a one-column matrix. When data = NULL
,
the internal layout
data will be used by default. Additionally, data
can
be a function (including purrr-like lambdas), which will be applied to the
layout
data.
It is important to note that we consider the rows
as the observations. It
means the NROW(data)
must return the same number with the specific layout
axis (meaning the x-axis for vertical stack layout, or y-axis for horizontal
stack layout).
heatmap_layout()
: for column annotation, the layout
data will be
transposed before using (If data is a function
, it will be applied with
the transposed matrix). This is necessary because column annotation uses
heatmap columns as observations, but we need rows.
stack_layout()
: the layout
data will be used as it is since we place
all plots along a single axis.
A single boolean value indicates whether to set the active
context to current plot. If TRUE
, all subsequent ggplot elements will be
added into this plot.
A string of the plot name. Used to switch the active context in
hmanno()
or stack_active()
.
ggheatmap(matrix(rnorm(81), nrow = 9)) +
hmanno("l") +
align_order(I("rowMeans"))
Run the code above in your browser using DataLab