mergeMassPeaks | R Documentation |
MassPeaks
objects.
This function merges MassPeaks
objects.
mergeMassPeaks(l, labels, method=c("mean", "median", "sum"), ignore.na=TRUE,
...)
l |
|
labels |
|
method |
used merge method. |
ignore.na |
Should |
... |
arguments to be passed to underlying functions (currently only
|
Returns a single (no labels
given) or a list
(labels
given) of merged MassPeaks
objects.
Sebastian Gibb mail@sebastiangibb.de
MassPeaks
,
averageMassSpectra
Website: https://strimmerlab.github.io/software/maldiquant/
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.