Function to detect if two peaks in a density spectrum can be considered separate based on a user supplied threshold. Creates a sequence of divisions from the troughs immediately preceding any significant peaks, then bins occurrences for a given taxon name by those divisions.
threshold_peaks(
x,
y,
ycols = c("genus", "max_ma", "min_ma"),
thresh = 15,
verbose = TRUE
)
A list of significant peaks as returned by find_peaks
An occurrence dataset with taxon names corresponding to the list names of x
A character vector denoting, in order, the taxon, FAD and LAD columns in y
The threshold distance between peaks above which they will be considered distinct - given in Ma
A logical determining if function progress should be reported