Reorders layout observations based on weights or summary statistics.
Source:R/align-reorder.R
align_reorder.Rd
Reorders layout observations based on weights or summary statistics.
Usage
align_reorder(
fun = rowMeans,
...,
strict = TRUE,
decreasing = FALSE,
data = NULL,
set_context = FALSE,
name = NULL
)
Arguments
- fun
A summary function. It should take a data and return the weights for the layout observations.
- ...
Additional arguments passed to
fun
.- strict
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.- decreasing
A boolean value. Should the sort order be increasing or decreasing?
- data
A matrix, a data frame, or even a simple vector that will be converted into a one-column matrix. If the
data
argument is set toNULL
, thealign_*
will use thelayout
data. Additionally, thedata
argument can also accept a function (purrr-like lambda is also okay), which will be applied with thelayout
data,It is important to note that all
align_*
functions consider therows
as the observations. It means theNROW(data)
must return the same number with the parallellayout
axis.layout_heatmap
: for column annotation, thelayout
data will be transposed before using (If data is afunction
, it will be applied with the transposed matrix). This is necessary because column annotation uses heatmap columns as observations, but we need rows.layout_stack
: thelayout
data will be used as it is since we place all plots along a single axis.
- set_context
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.- name
A string of the plot name. Used to switch the active context in
hmanno()
orstack_active()
.