How do I create a function that defines a moving threshold along local maxima in R?
问题 The goal is to quantify a certain growth. The definition is as follows: Every value in the sequence shall be compared to the preceding value and if the following value is greater than the preceding one, it shall be taken into regard (returned). If not, it shall be dropped. Consequently, the greater value is used as a new reference for the following ones. A threshold that moves with the ascending values. I've tried this: growthdata<-c(21679, 21722, 21788, 21863, 21833, 21818, 21809, 21834,