MultiBlock: MultiBlock

View source: R/MultiBlock.R

MultiBlockR Documentation

MultiBlock

Description

Creates a MultiBlock object from a named list of data blocks.

Usage

MultiBlock(
  Samples = NULL,
  Data,
  Variables = NULL,
  Batch = NULL,
  Metadata = NULL,
  ignore.names = FALSE,
  ignore.size = FALSE
)

Arguments

Samples

A vector of sample names shared across all blocks (optional). When omitted, sample names are taken from the row names of each block. If no row names exist and all blocks have the same number of rows, samples are numbered as integers. Use ignore.names or ignore.size for more flexible behaviour.

Data

A named list of matrices or data.frames (one entry per block).

Variables

A named list of variable-name vectors, one per block (optional). When omitted, column names are taken from each block; if absent, variables are numbered as integers.

Batch

A named list of batch vectors, one per block (optional).

Metadata

A named list of metadata data.frames, one per block (optional).

ignore.names

If TRUE, sample names are not checked across blocks. All blocks must have the same number of rows unless ignore.size is also TRUE.

ignore.size

If TRUE (only meaningful when ignore.names = TRUE), blocks with different row counts are accepted. The resulting MultiBlock stores a per-block Samples list and is not directly suitable for ComDim (use SplitRW() first).

Value

A MultiBlock object.

References

Puig-Castellví F, Jouan-Rimbaud Bouveresse D, Mazéas L, Chapleur O, Rutledge DN (2021). Rearrangement of incomplete multi-omics datasets combined with ComDim for evaluating replicate cross-platform variability and batch influence. Chemometrics and Intelligent Laboratory Systems, 218, 104422. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.chemolab.2021.104422")}

Examples

b1 <- matrix(rnorm(500), 10, 50) # 10 samples, 50 variables
b2 <- matrix(rnorm(800), 10, 80) # 10 samples, 80 variables
# Minimal call: Samples and Variables are filled in automatically.
mb <- MultiBlock(Data = list(b1 = b1, b2 = b2))

# With explicit sample names (enables cross-block alignment):
rownames(b1) <- paste0("s", 1:10)
rownames(b2) <- paste0("s", 1:10)
mb <- MultiBlock(Data = list(b1 = b1, b2 = b2))

# Blocks with different row counts (replicate design):
b3 <- matrix(rnorm(800), 30, 80)
batch_b3 <- c(rep(1, 10), rep(2, 10), rep(3, 10))
mb3 <- MultiBlock(
  Data = list(b3 = b3), Batch = list(b3 = batch_b3),
  ignore.names = TRUE, ignore.size = TRUE
)

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