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

\item{block}{The name of the block to modify (character). If \code{NULL} and
the MultiBlock contains a single block, that block is used automatically.
To modify several blocks at once, pass a character vector of block names.}

\item{batches}{A numeric vector of batch labels, one per sample in the
target block. Replaces any existing Batch entry for that block.}

\item{metadata}{A data.frame with one row per sample in the target block.
Replaces any existing Metadata entry for that block.}
}
\value{
The updated MultiBlock.
}
\description{
Adds or overwrites batch and/or metadata information for one or more blocks
of an existing MultiBlock object.
}
\examples{
b1 <- matrix(rnorm(500), 10, 50) # 10 samples, 50 variables
b2 <- matrix(rnorm(800), 10, 80) # 10 samples, 80 variables
batch_b1 <- rep(1, 10)
meta_b1 <- data.frame(condition = rep(c("A", "B"), 5))
mb <- MultiBlock(Data = list(b1 = b1, b2 = b2))
# Add batch information to block 'b1':
mb <- AddMetadata(mb, block = "b1", batches = batch_b1)
# Add (or overwrite) metadata for block 'b1':
mb <- AddMetadata(mb, block = "b1", metadata = meta_b1)
}
\seealso{
\code{\link{MultiBlock}}, \code{\link{FilterSamplesMultiBlock}}
}
