Learn R Programming

GCalignR (version 1.0.7)

find_peaks: Detect local maxima in time series

Description

Detects peaks in a vector and calculates the peak height. This function is only appropriate for symmetric gaussian peaks and does not take into account any baseline correction as it required in 'real word' data. Therefore, it does not substitute sophisticated peak detection and integration tools and is only used for illustration purposes in our vignettes.

Usage

find_peaks(df)

Value

A data frame containing x and y coordinates of peaks.

Arguments

df

A data frame containing x and y coordinates.

Author

Meinolf Ottensmann (meinolf.ottensmann@web.de) & Martin Stoffel (martin.adam.stoffel@gmail.com)

Examples

Run this code
## create df
df <- data.frame(x = 1:1000, y = dnorm(1:1000,300,20))
## plot
with(df, plot(x,y))
## detect peak
find_peaks(df)

Run the code above in your browser using DataLab