hist_find_peaks.minvalue: Find peaks in given histgram by truncing at a threshold...

View source: R/histgram.R

hist_find_peaks.minvalueR Documentation

Find peaks in given histgram by truncing at a threshold values.

Description

Find peaks in given histgram. The peaks are devided by the majority of peak devision with changing threshold of the ignoring values [min,max].

Usage

hist_find_peaks.minvalue(hist.data, min, max, n = 101)

Arguments

hist.data

The target histgram

min

The minmum value of the threshold.

max

The maximum value of the threshold.

n

The step of the threshold change.

Value

Table of the peaks with lower number, upper number, top number (maximum position within the peak) and frequency of each peaks.

Examples

hist.data = c(1,5,7,5,5,4,3,1,0,0,0,4,4,8,5,5,5,5,3,3,3,7,7,8,3,3,1,3,5,0,0,2,3,3,0)
peaks = hist_find_peaks.minvalue(hist.data,0,6)
plot(hist.data,type="b",lwd=2)
for(i in 1:nrow(peaks)){
	segments(peaks$top[i],-1,peaks$top[i],10,col="red")
	polygon(
		c(peaks$lower[i],peaks$lower[i],peaks$upper[i],peaks$upper[i]),c(-1,10,10,-1),
		col=rgb(1,0,0,0.2),border=NA
	)
}

hmito/hmRLib documentation built on March 13, 2024, 9:41 p.m.