Prepare data variables for plot building by splitting into matrices and ordering rows and columns. Includes pre-defined settings for plotting Nightingale metabolomics data.
formatData(
data,
rowName = "rowName",
colName = "colName",
plotGroup = "plotGroup",
colorValue = "colorValue",
sizeValue = "sizeValue",
rowOrder = NULL,
colOrder = NULL,
listOrder = NULL,
nightingale = TRUE
)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.
Dataset containing variables to be plotted on color and size scales with additional matrix layout specification variables (see details).
String naming the variable of data which defines rows
of each matrix.
String naming the variable of data which defines
columns of each matrix.
String naming the variable of data which groups the
dataset into plots.
String naming the variable of data containing the
values to be plotted on the color scale.
String naming the variable of data containing the
values to scale bubble sizes.
List of vectors of character strings matching the values of
rowName for each plot. List names should match values of
plotGroup. Can be NULL (default) if no sorting required or
when using inbuilt Nightingale ordering. If used, it is not necessary for
all plots to have list entries, but each entry should include all row
names for that plot.
As rowOrder for columns and colName.
Vector of character strings matching values of
plotGroup variable, or NULL (default) if no sorting
required or when using inbuilt Nightingale ordering.
Logical - use Nightingale style settings?
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.
data <- merge_template(cetp, "ckb_id")
formatData(data, colorValue = "estimate", sizeValue = "negLog10P",
nightingale = TRUE)
Run the code above in your browser using DataLab