I need to calculate the Area under the curve where a global maxima has been observed. As shown in below image, i first need to find the global maxima and then estimate the area under that curve (where global maxima was observed. Below is the sample data.
Sample DF:
Df <- c(1, 2, 1, 1.3, 1.2, 1, 2, 1, 21, 23, 24, 25, 24, 23, 26, 23, 17, 11, 2, 1, 1, 2, 2 , 7, 9, 2,)
Sorry, I couldn't get any ideas with the code because in reality the data I have has lot of local maxima/minima (noise). All I am interested is to find that global maxima & estimate the area under curve.
Expected Output:
Global Maxima: Area Under that Curve: