zack holden: > I need to sort through a vector (x) and identify the point at which 2 > successive values become smaller than the previous value.
x <- c(5,5,7,6,5,4,3) a=c(diff(x, 1) < 0, FALSE) & c(diff(x, 2) < 0, FALSE, FALSE) a # FALSE FALSE TRUE TRUE TRUE FALSE FALSE which(a) # 3 4 5 Heikki Kaskelma ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.