Adjust `span`, `local.threshold` or `ignore.threshold` dynamically to limit the number of peaks
New parameter n.max could be used to dynamically adjust span, local_threshold or ignore.threshold values to keep the number of extracted peaks below or equal to a user-set maximum number.
Given that local threshold for peak height is implemented in 'ggpmisc' 0.6.2, the dynamic limit to the number of peaks could be most effectively implemented by adjusting the value of local.threshold rather the the global ignore.threshold or span. Using local.thresold would make it possible to ignore the locally least prominent peaks. Increasing the span is suitable if the aim is to ignore all but one of groupd of neighbouring peaks. Using the global threshold would retain only the tallest peaks. This also applies to valleys, obviously.
Rather than automation, I am inclined to implementing a reference for local threshold that is less dependent on span. See #79.