correct_for_factor: Correct metabolite measurements for a factor

Description Usage Arguments Value

Description

Replace the measurements of every metabolite by the residuals from regressing the metabolite on x, where x is converted to a factor.

Usage

1

Arguments

mat

Matrix with samples as columns and metabolites as rows

x

Factor for which to correct the metabolite measurements in mat

Value

A matrix of the same dimensions as mat where every metabolite's measurements were replaced by the residuals from regressing the metabolite on the x treated as a factor. If a metabolite consists only of NAs, the residuals for that metabolite will also be NAs. The same happens when a metabolite has no valid variance (because there is only a single non-NA measurement) or when the metabolite has zero variance.


cbhelmholtz/metaboliteqc documentation built on May 13, 2019, 2:03 p.m.