stat_peaks function

Local maxima (peaks) or minima (valleys)