R/removeEmptyMassObjects-functions.R

Defines functions removeEmptyMassObjects

Documented in removeEmptyMassObjects

## removeEmptyMassObjects
##  find and remove empty AbstractMassObject objects in a MassObjectsList
##
## params:
##  l: list of AbstractMassObject objects
##
## returns:
##  a list without empty objects
##
removeEmptyMassObjects <- function(l) {

  .stopIfNotIsMassObjectList(l)

  ## find empty MassPeaks objects
  notEmpty <- !(seq_along(l) %in% findEmptyMassObjects(l))

  ## exclude empty elements
  l[notEmpty]
}

Try the MALDIquant package in your browser

Any scripts or data that you put into this service are public.

MALDIquant documentation built on May 29, 2024, 6:11 a.m.