Displaying 1 result from an estimated 1 matches for "peak2return".
2011 Nov 24
1
Need some vectorizing help
...is crossed later. I don't care about peaks that may be
lower than this first one - they can be ignored. I've tried some sapply
methods along the way, but they all are slower. The best solution I
have is a loop, and I just know there are smart R folks that could help
me eliminate it.
Peak2Return <- function(v) {
Q <- (1:m)[diff(v)<0] ; find all the peaks
L <- Q[c(TRUE,v[Q[-1]] > v[Q[-length(Q)]])]
;
eliminate lower peaks
R <- sapply(L,function (x,v) { ((x+1):length(v))...