findPeakWidth {tofsims} | R Documentation

## generic method findPeakWidth

### Description

generic method findPeakWidth

method findPeakWidth

### Usage

    findPeakWidth(object, p = 3, n = 5, span = 100, widthExtLower = 1.5,
      widthExtUpper = 1.75, ...)

    ## S4 method for signature 'PeakList'
    findPeakWidth(object, p = 3, n = 199, span = 100,
      widthExtLower = 1.7, widthExtUpper = 2, ...)

### Arguments

`object` | object of class PeakList
`p` | numeric value for savitzky-golay filter on first derivate
`n` | numeric value for savitzky-golay filter on first derivate
`span` | numeric smoothing for determining local minima/maxima values
`widthExtLower` | numeric factor to extend lower peak width
`widthExtUpper` | numeric factor to extend upper peak width
`...` | additional args

### Details

This method uses signal processing to determine lower and upper peak width limits based on local max/min detection of the first derivate next to peak center values. The initial code for local min/max detection is adapted from the CRAN package 'ChemometricsWithR'.

### Value

object of class PeakList with updated peaks

### Examples

    library(tofsimsData)
    data(tofsimsData)
    testPeakList<-PeakList(analysisName = analysisName(testSpectra),
    instrument = instrument(testSpectra),
    nz = nz(testSpectra),
    calibration = calibration(testSpectra),
    calibPoints = calibPoints(testSpectra),
    mz = mz(testSpectra),
    peakIDs = NULL,
    peakMzs = NULL)
    par(mfcol=c(1,2))
    plot(testPeakList, mzRange=c(25,32), type = 'l')
    testPeakList<-addPeaks(testPeakList, mzs=26:31, width=0.4)
    testPeakList<-findPeakWidth(testPeakList, p = 3, n = 199,
    span = 100, widthExtLower = 2, widthExtUpper = 2)
    plot(testPeakList, mzRange=c(25,32), type = 'l')

[Package tofsims version 1.12.0 Index]