find_peaks: Find the index of peaks in a sequence of numeric values.

View source: R/utils.R

find_peaksR Documentation

Find the index of peaks in a sequence of numeric values.

Description

Find the index of peaks in a sequence of numeric values. Peaks value should be larger than any values among the left/right shoulder. If no peaks found, function will return the index of the max number.

Usage

find_peaks(x, left_shoulder = 10000, right_shoulder = 10000)

Arguments

x

A numeric vector.

left_shoulder

A integer value. Peaks value should larger than any value in the left left_shoulder value.

right_shoulder

A integer value. Peaks value should larger than any value in the right right_shoulder value.

Value

A vector of the index of peaks.

Examples

x <- c(0, 1, 3, 6, 9, 12, 11, 7, 9, 5, 1, 9, 0, 1, 2)
pks <- find_peaks(x, left_shoulder = 3, right_shoulder = 3)
pks

zh542370159/dropSplit documentation built on June 19, 2022, 2:49 p.m.