% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/svaEnmix_steps.R
\name{mergeSvaTargetsEnmix}
\alias{mergeSvaTargetsEnmix}
\title{Merge surrogate variables into the phenotype table}
\usage{
mergeSvaTargetsEnmix(
  targets,
  sva,
  SampleID = "Sample_Name",
  verbose = FALSE,
  logs = FALSE,
  log_dir = NULL,
  log_file = "log_mergeSvaTargetsEnmix.txt"
)
}
\arguments{
\item{targets}{Phenotype data frame aligned with the samples in \code{sva}.}

\item{sva}{Numeric matrix of surrogate variables with samples in rows.}

\item{SampleID}{Character. Name of the phenotype sample identifier column.}

\item{verbose}{Logical. If \code{TRUE}, emit progress messages with \code{message()}.}

\item{logs}{Logical. If \code{TRUE}, write the same messages to a log file.}

\item{log_dir}{Character or \code{NULL}. Directory used for the log file when
\code{logs = TRUE}.}

\item{log_file}{Character. File name used when \code{logs = TRUE}.}
}
\value{
A phenotype data frame with the surrogate variables appended.
}
\description{
Merge the surrogate variable matrix back into the phenotype table while
preserving the original row order of \code{targets}.
}
\examples{
ex <- dnaEPICO:::exampleSvaAnalysisStateDnaEpico()
merged_pheno <- mergeSvaTargetsEnmix(
    targets = ex$targets,
    sva = ex$sva,
    SampleID = "Sample_Name",
    verbose = FALSE,
    logs = FALSE
)
colnames(merged_pheno)[seq_len(4)]

}
