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

findEmptyMassObjects-functions

Finds or removes empty AbstractMassObject objects in a list.


Description

These functions looks for empty AbstractMassObject objects in a list.

Usage

findEmptyMassObjects(l)

removeEmptyMassObjects(l)

Arguments

l

list, list of AbstractMassObject where empty objects should be found or removed.

Value

findEmptyMassObjects: Returns a vector of indices referring to empty AbstractMassObject objects.

removeEmptyMassObjects: Returns a list of AbstractMassObject objects but without empty ones.

Author(s)

Sebastian Gibb mail@sebastiangibb.de

See Also

Examples

## load package
library("MALDIquant")

## create list
peakList <- list()

## create two MassPeaks objects and add them to the list
peakList[[1]] <- createMassPeaks(mass=1:100, intensity=1:100,
                                 metaData=list(name="example 1"))
peakList[[2]] <- createMassPeaks(mass=1:100, intensity=1:100,
                                 metaData=list(name="example 2"))

## find empty objects (there should not be any one)
findEmptyMassObjects(peakList)

## add an empty MassPeaks object to the list
peakList[[3]] <- createMassPeaks(mass=double(), intensity=double(),
                                 metaData=list(name="empty MassPeaks object"))

## look for empty objects (isEmptyIdx == 3)
(isEmptyIdx <- findEmptyMassObjects(peakList))

## to remove all empty MassObjects from a list
length(peakList) # 3
peakList <- removeEmptyMassObjects(peakList)
length(peakList) # 2; WARNING: all indices could changed

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.