View source: R/ExpandMultiBlock.R
| ExpandMultiBlock | R Documentation |
Splits data into several blocks, allowing variables to appear in more than one block
simultaneously. Each variable is duplicated into every block to which it is assigned according
to the metadata mapping table.
ExpandMultiBlock(data = NULL, metadata = NULL, minblock = 0, loquace = TRUE)
data |
A data.frame or matrix with samples in rows and variables in columns. |
metadata |
A 2-column data.frame describing how variables are assigned to blocks. The
first column gives the block name; the second column gives the variable name, and must match
the column names of |
minblock |
Integer. Blocks with fewer than |
loquace |
Logical. If |
For each row in metadata that matches a variable in data, the variable's
values are copied into the corresponding block column. Column names in the resulting expanded
matrix are formed as <block>.<variable>. Variables with all-NA values after
expansion are removed. If no matches exist between data column names and
metadata, NULL is returned with a warning. If minblock filtering
removes all blocks, NULL is returned.
A MultiBlock object whose blocks are defined by the first column of
metadata, or NULL if no valid blocks could be constructed.
MultiBlock, ProcessMultiBlock
data(mouse_ds)
lipidsMB <- ExpandMultiBlock(data = lipids, metadata = metadata_lipids,
minblock = 0, loquace = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.