ExpandMultiBlock: ExpandMultiBlock

View source: R/ExpandMultiBlock.R

ExpandMultiBlockR Documentation

ExpandMultiBlock

Description

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.

Usage

ExpandMultiBlock(data = NULL, metadata = NULL, minblock = 0, loquace = TRUE)

Arguments

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 data. A variable may appear in multiple rows (and therefore in multiple blocks).

minblock

Integer. Blocks with fewer than minblock variables are discarded. Use 0 (default) to keep all blocks regardless of size.

loquace

Logical. If TRUE (default), a warning is printed listing column names in data that have no matching entry in the second column of metadata.

Details

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.

Value

A MultiBlock object whose blocks are defined by the first column of metadata, or NULL if no valid blocks could be constructed.

See Also

MultiBlock, ProcessMultiBlock

Examples

data(mouse_ds)
lipidsMB <- ExpandMultiBlock(data = lipids, metadata = metadata_lipids,
  minblock = 0, loquace = FALSE)

R.ComDim documentation built on May 13, 2026, 9:07 a.m.