Merge the surrogate variable matrix back into the phenotype table while preserving the original row order of targets.

mergeSvaTargetsEnmix(
  targets,
  sva,
  SampleID = "Sample_Name",
  verbose = FALSE,
  logs = FALSE,
  log_dir = NULL,
  log_file = "log_mergeSvaTargetsEnmix.txt"
)

Arguments

targets

Phenotype data frame aligned with the samples in sva.

sva

Numeric matrix of surrogate variables with samples in rows.

SampleID

Character. Name of the phenotype sample identifier column.

verbose

Logical. If TRUE, emit progress messages with message().

logs

Logical. If TRUE, write the same messages to a log file.

log_dir

Character or NULL. Directory used for the log file when logs = TRUE.

log_file

Character. File name used when logs = TRUE.

Value

A phenotype data frame with the surrogate variables appended.

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)]
#> [1] "Sample_Name"      "Sentrix_ID"       "Sentrix_Position" "sva1"