R/replaceNegativeIntensityValues-functions.R

Defines functions .replaceNegativeIntensityValues

## .replaceNegativeIntensityValues
##  replaces negative intensity valus by zeros
##
## params:
##  object AbstractMass Object
##  warn: throw a warning?
##
## returns:
##  an AbstractMass object
##
.replaceNegativeIntensityValues <- function(object, warn=TRUE) {
  if (any(object@intensity < 0L, na.rm=TRUE) && !isEmpty(object)) {
    if (warn) {
      warning("Negative intensity values are replaced by zeros.")
    }
    object@intensity[which(object@intensity < 0L)] <- 0L
  }
  object
}

Try the MALDIquant package in your browser

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

MALDIquant documentation built on March 31, 2023, 10:40 p.m.