This function grabs the last peak or shoulder.
get.last.mode(x, y, rare.prop = 1/5, verbose = TRUE, remove.tail = TRUE, ...)
values of midpoints from hist
values of counts from hist
Proportion used to remove rare intensity tail
print diagnostic output
Remove rare intensity tail
arguments to be passed to smooth_hist
Value of x that is the last peak
data(t1.voi.hist)
system.time({
y = t1.voi.hist$counts
x = t1.voi.hist$mids
x = x[!is.na(y)];
y = y[!is.na(y)]
# 20 used for speed of example
nawm_peak = get.last.mode(x, y, k=20)
plot(t1.voi.hist, border="red")
abline(v=nawm_peak)
})
#> Smoothing Histogram
#> Smoothing Derivative
#> user system elapsed
#> 0.317 0.007 0.324