Sorry, thought you wanted to find lowest value of x that produced maximum value of y. I see now that is not the case.
I think you have to decide on what amount of improvement per device you judge to be 'minimal'. Then the algorithm uses the value of y that occurs at the point where this criterion is reached. I think this will do it min(devices[diff(percentages)<criterion]) Bill ______________________________________________ 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.