pick.peaks: Peak-picking function.

Description Usage Arguments Value Author(s) Examples

View source: R/miscfunctions.R

Description

Function to identify local maxima in a vector, typically a spectrum or a chromatogram.

Usage

1
pick.peaks(x, span)

Arguments

x

Numerical vector.

span

Neighbourhood, used to define local maxima.

Value

A vector containing positions of local maxima in the input data.

Author(s)

Ron Wehrens

Examples

1
2
3
4
5
6
7
if (require("ptw")) {
data(lcms, package = "ptw")
plot(lcms[1,,1], type = "l", xlim = c(1000, 1500))
abline(v = pick.peaks(lcms[1,,1], 20), col = "blue")
} else {
  cat("Package ptw not available.\nInstall it by typing 'install.packages(\"ptw\")'")
}

Example output

Attaching package: 'ChemometricsWithR'

The following objects are masked from 'package:stats':

    loadings, screeplot

Loading required package: ptw

ChemometricsWithR documentation built on May 2, 2019, 10:25 a.m.