View source: R/sequence_characteristics.R
count_peaks | R Documentation |
Peaks are identified as patterns of increase, possibly followed by a constant stretch, which ends in a decrease.
count_peaks(x, min_change = 0)
x |
A numeric vector |
min_change |
A numeric value. The size of a minimal change between
two consecutive values of |
An integer value representing the number of peaks
count_peaks(c(0, 1, 0, 1, 0)) ## expect 2 peaks
count_peaks(c(0, 1, 0, 1)) ## expect 1 peak
count_peaks(c(1, 0, 1)) ## expect 0 peak
count_peaks(c(0, 1, 1, 2.5, 5.1, 4.9)) ## expect 1 peak
count_peaks(c(0, 1, 1, 2.5, 5.1, 4.9), min_change = 0.5) ## expect 0 peak
count_peaks(c(0, 1, 1, 0.8, 5.1, 4)) ## expect 2 peak
count_peaks(c(0, 1, 1, 0.8, 5.1, 4), min_change = 0.1) ## expect 2 peak
count_peaks(c(0, 1, 1, 0.8, 5.1, 4), min_change = 0.5) ## expect 1 peak
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.