removeIntensity-Chromatogram: Remove intensities from chromatographic data

removeIntensity,Chromatogram-methodR Documentation

Remove intensities from chromatographic data

Description

removeIntensities allows to remove intensities from chromatographic data matching certain conditions (depending on parameter which). The intensities are actually not removed but replaced with NA_real_. To actually remove the intensities (and the associated retention times) use clean() afterwards.

Parameter which allows to specify which intensities should be replaced by NA_real_. By default (which = "below_threshod" intensities below threshold are removed. If x is a XChromatogram or XChromatograms object (and hence provides also chromatographic peak definitions within the object) which = "outside_chromPeak" can be selected which removes any intensity which is outside the boundaries of identified chromatographic peak(s) in the chromatographic data.

Note that filterIntensity() might be a better approach to subset/filter chromatographic data.

Usage

## S4 method for signature 'Chromatogram'
removeIntensity(object, which = "below_threshold", threshold = 0)

## S4 method for signature 'MChromatograms'
removeIntensity(object, which = "below_threshold", threshold = 0)

## S4 method for signature 'XChromatogram'
removeIntensity(
  object,
  which = c("below_threshold", "outside_chromPeak"),
  threshold = 0
)

Arguments

object

an object representing chromatographic data. Can be a Chromatogram(), MChromatograms(), XChromatogram() or XChromatograms() object.

which

character(1) defining the condition to remove intensities. See description for details and options.

threshold

numeric(1) defining the threshold below which intensities are removed (if which = "below_threshold").

Value

the input object with matching intensities being replaced by NA.

Author(s)

Johannes Rainer

Examples


library(MSnbase)
chr <- Chromatogram(rtime = 1:10 + rnorm(n = 10, sd = 0.3),
    intensity = c(5, 29, 50, NA, 100, 12, 3, 4, 1, 3))

## Remove all intensities below 20
res <- removeIntensity(chr, threshold = 20)
intensity(res)

sneumann/xcms documentation built on Nov. 23, 2024, 6:53 p.m.