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

mergeMassPeaks-functions

Merges MassPeaks objects.


Description

This function merges MassPeaks objects.

Usage

mergeMassPeaks(l, labels, method=c("mean", "median", "sum"), ignore.na=TRUE,
               ...)

Arguments

l

list, list of MassPeaks objects.

labels

list, list of factors (one for each MassPeaks object) to do groupwise merging.

method

used merge method.

ignore.na

Should NA (positions where a peak is missing) ignored (ignore.na=TRUE) or treated as zero (ignore.na=FALSE)?

...

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

Value

Returns a single (no labels given) or a list (labels given) of merged MassPeaks objects.

Author(s)

Sebastian Gibb mail@sebastiangibb.de

See Also

Examples

## load package
library("MALDIquant")

## create four MassPeaks objects and add them to the list
p <- list(createMassPeaks(mass=1:2, intensity=1:2),
          createMassPeaks(mass=1:3, intensity=1:3),
          createMassPeaks(mass=1:4, intensity=1:4),
          createMassPeaks(mass=1:5, intensity=1:5))

## merge all four MassPeaks objects into a single new one
## by sum their intensities
## (no labels, returns only one new MassPeaks object)
mergedPeaks <- mergeMassPeaks(p, method="sum")

## only merge MassPeaks objects in a group
## (two different labels, returns a list of two new MassPeaks objects)
groups <- factor(c("a", "a", "b", "b"), levels=c("a", "b"))
mergedPeaks <- mergeMassPeaks(p, labels=groups, method="mean")

## the same, but treat NA as zero
mergedPeaks <- mergeMassPeaks(p, labels=groups, method="mean", ignore.na=FALSE)

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.