Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

averageMassSpectra-functions

Averages MassSpectrum objects.


Description

This function averages MassSpectrum objects.

Usage

averageMassSpectra(l, labels, method=c("mean", "median", "sum"), ...)

Arguments

l

list, list of MassSpectrum objects.

labels

list, list of factors (one for each MassSpectrum object) to do groupwise averaging.

method

used aggregation function.

...

arguments to be passed to underlying functions (currently only mc.cores is supported).

Details

The mass of the averaged MassSpectrum object will be the mass of the first non-empty MassSpectrum object (of each group).

Value

Returns a single (no labels given) or a list (labels given) of averaged MassSpectrum objects.

Author(s)

Sebastian Gibb mail@sebastiangibb.de

See Also

Examples

## load package
library("MALDIquant")

## create four MassSpectrum objects and add them to a list
s <- list(createMassSpectrum(mass=1:5, intensity=1:5),
          createMassSpectrum(mass=1:5, intensity=1:5),
          createMassSpectrum(mass=1:5, intensity=6:10),
          createMassSpectrum(mass=1:5, intensity=6:10))

## average all four MassSpectrum objects into a single new one
## by sum their intensities
## (no labels, returns only one new MassSpectrum object)
summedSpectra <- averageMassSpectra(s, method="sum")

## only average MassSpectrum objects in a group
## (e.g. useful for technical replicates)
## (two different labels, returns a list of two new MassPeaks objects)
groups <- factor(c("a", "a", "b", "b"), levels=c("a", "b"))
averagedSpectra <- averageMassSpectra(s, labels=groups, method="mean")

MALDIquant

Quantitative Analysis of Mass Spectrometry Data

v1.19.3
GPL (>= 3)
Authors
Sebastian Gibb [aut, cre] (<https://orcid.org/0000-0001-7406-4443>), Korbinian Strimmer [ths] (<https://orcid.org/0000-0001-7917-2056>)
Initial release
2019-05-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.