% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/MultiBlock2Matrix.R
\name{MultiBlock2Matrix}
\alias{MultiBlock2Matrix}
\title{MultiBlock2Matrix}
\usage{
MultiBlock2Matrix(MB = MB, blocks = NULL, vars = NULL)
}
\arguments{
\item{MB}{A \code{MultiBlock} object.}

\item{blocks}{The blocks to combine. A vector of integers (block indices) or a vector of block
names. When omitted, all blocks are included.}

\item{vars}{The variables to keep. A list of the same length as \code{blocks}. Each element
contains the indices (integer) or names (character) of the variables to retain from the
corresponding block. When omitted, all variables in each block are included.}
}
\value{
A numeric matrix with rows corresponding to samples and columns corresponding to the
  variables of the selected blocks concatenated in order.
}
\description{
Combines the blocks of a MultiBlock into a single matrix by column-binding the selected blocks.
Useful for computing summary statistics across the whole MultiBlock (e.g. maximum value).
}
\details{
Blocks are column-bound in the order given by \code{blocks}. Row names of the output matrix
  are the sample names of \code{MB}. Column names are the variable names; if the same variable
  name appears in more than one block, duplicates are disambiguated by appending
  \code{.<block_name>} to all occurrences of the repeated name, and a warning is issued.
}
\examples{
b1 <- matrix(rnorm(500), 10, 50)
b2 <- matrix(rnorm(800), 10, 80)
mb <- MultiBlock(Data = list(b1 = b1, b2 = b2))
# Combine all blocks into a matrix and compute a summary statistic:
mat <- MultiBlock2Matrix(mb)
max(mat)
# Combine only the first block, keeping variables 1-10:
mat <- MultiBlock2Matrix(mb, blocks = 1, vars = list(1:10))
}
\seealso{
\code{\link{MultiBlock}}, \code{\link{ProcessMultiBlock}}
}
