extremaR is an R package for detecting peaks and troughs in 1D datasets, with optional smoothing, prominence, and distance filtering. Intended for geoscience applications such as grain-size distributions, elemental profiles, and paleoclimate time series.
# Install devtools if needed
# install.packages("devtools")
devtools::install_github("warnuk/extremaR")library(extremaR)
x <- seq(0, 2*pi, length.out = 1000)
y <- sin(2*x) + rnorm(1000, 0, 0.05)
extrema <- find_extrema(y, x, smooth_window = 11, min_prominence = 0.2)
plot_extrema(y, extrema, x)