formatData {bubbleHeatmap} | R Documentation |
Split Data Into Matrices and Reorder Rows and Columns.
Description
Prepare data variables for plot building by splitting into matrices and ordering rows and columns. Includes pre-defined settings for plotting Nightingale metabolomics data.
Usage
formatData(
data,
rowName = "rowName",
colName = "colName",
plotGroup = "plotGroup",
colorValue = "colorValue",
sizeValue = "sizeValue",
rowOrder = NULL,
colOrder = NULL,
listOrder = NULL,
nightingale = TRUE
)
Arguments
data |
Dataset containing variables to be plotted on color and size scales with additional matrix layout specification variables (see details). |
rowName |
String naming the variable of |
colName |
String naming the variable of |
plotGroup |
String naming the variable of |
colorValue |
String naming the variable of |
sizeValue |
String naming the variable of |
rowOrder |
List of vectors of character strings matching the values of
|
colOrder |
As |
listOrder |
Vector of character strings matching values of
|
nightingale |
Logical - use Nightingale style settings? |
Details
This function takes an input dataset with one row for each plot cell
and splits it into a list of plot datasets as defined by the variable
plotGroup
. Each plot dataset is then recast (using the
cast()
function from the reshape
package) into matrices defined
by the colName
and rowName
variables. Two matrices are produced
for each plot, containing the values of colorValue
and
sizeValue
respectively. To use the included Nightingale metabolomics
plot templates, the rowName
, colName
and plotGroup
variables can be merged from the options in the package datafiles
ntngale225/249
.
Value
A list of two lists of numeric matrices. The matrices in
colorList
contain values of data$colorValue
and those in
sizeList
contain values of data$sizeValue
. The matrice layouts
are defined by data$rowName
and data$colName
and each list has
one item for each unique value of data$plotGroup
.
Examples
data <- merge_template(cetp, "ckb_id")
formatData(data, colorValue = "estimate", sizeValue = "negLog10P",
nightingale = TRUE)