find_peaks: Robust peak finder

Description Usage Arguments Value Examples

View source: R/find_breaths.R

Description

Robust peak finder

Usage

1
find_peaks(x, width, prominence, idx_off = 0)

Arguments

x

[vector]

width

[vector(1)] width of search window

prominence

[vector(1)] minimum prominence of peaks

idx_off

[vector(1)] internal use only

Value

[matrix(n, 2)] first column is peak index, second column is peak prominence. Ordered by prominence.

Examples

1
2
3
4
5
6
set.seed(1202)
x <- seq(0, 4 * pi, length.out = 1e2)
y <- sin(x^1.4) + rnorm(length(x), sd = 0.25)
peaks <- find_peaks(y, width = 10, prominence = 0.5)
plot(seq_along(x), y, type = "l")
abline(v = peaks[,1], lty = 3)

FlukeAndFeather/breath documentation built on April 25, 2020, 3:15 a.m.