find_peak_boundaries: find_peak_boundaries

View source: R/app_functions.R

find_peak_boundariesR Documentation

find_peak_boundaries

Description

find_peak_boundaries will find the start and end point of a peak based on curve derivative.

Usage

find_peak_boundaries(
  int = NULL,
  p = which.max(int),
  k = 3,
  min_scans = 3,
  noise = 0
)

Arguments

int

Numeric vector (of intensity values).

p

Index of peak position (usually 'which.max(int)).

k

Number of scans at peak boarder to confirm peak valley.

min_scans

Minimum number of scans in front or tail.

noise

A threshold value. All Values below or equal to noise will be set to zero.

Details

This function provides a simple detection algorithm for peak boundaries. It will accept a numeric vector as input and determine relative to the global maximum (or a user provided local maximum) the left and right border where intensity decrease ends and intensity is increasing again.

Value

A numeric vector of length 2 giving the indexes of peak start and peak end.

Examples

## Not run: 
x <- sin(seq(-pi,2*pi,0.01))+1
plot(x)
abline(v=find_peak_boundaries(x))

## End(Not run)

IsoCor documentation built on Sept. 11, 2024, 9:30 p.m.