R/totalIonCurrent-methods.R

## MassSpectrum
setMethod(f="totalIonCurrent",
          signature=signature(object="MassSpectrum"),
          definition=function(object) {

  left <- as.double(head(object@intensity, -1L))
  right <- as.double(tail(object@intensity, -1L))

  as.double(sum((left + right) / 2L * diff(object@mass), na.rm=TRUE))
})

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.