View source: R/MetaboliteANOVA.R
MetaboliteANOVA | R Documentation |
MetaboliteANOVA
will perform an ANOVA on columns
of a data matrix according to a specified model.
MetaboliteANOVA(
dat = NULL,
sam = NULL,
model = NULL,
method = "none",
silent = FALSE
)
dat |
Data matrix (e.g. of metabolite). |
sam |
Sample table (same number of row as 'dat' and containing all columns specified in 'model'. |
model |
ANOVA model. May include +, * and : together with column names of sam (cf. Examples). |
method |
The method to be used in column wise multiple testing adjustment, see |
silent |
Logical. Shall the function print warnings to the console? |
The function is a wrapper for lm
including some sanity checks.
It will accept a data matrix (traits in columns), sample information (data.frame)
and a potential model as input, compute an ANOVA per column and return
the respective P-values in a named matrix for further plotting or export.
A named matrix of P-values (rows=metabolites/traits; cols=ANOVA factors).
# load raw data and sample description
raw <- MetabolomicsBasics::raw
sam <- MetabolomicsBasics::sam
# compute P-values according to specified ANOVA model (simple and complex)
head(m1 <- MetaboliteANOVA(dat = raw, sam = sam, model = "GT"))
head(m2 <- MetaboliteANOVA(dat = raw, sam = sam, model = "GT+Batch+Order+MP"))
# compare P-values for one factor determined in both models
hist(log10(m2[, "GT"]) - log10(m1[, "GT"]), main = "")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.