On Fri, 13 Sep 2013, William Dunlap wrote:
You may want to append -Inf (or 0 if you know the data cannot be negative) to the start of your 'values' vector so you don't have to write code to catch the cases when a threshold is below the range of the values. > findInterval(thresholds, c(0,values,Inf)) [1] 1 5 5 5 8 > c(0, values, Inf)[.Last.value] [1] 0.000 1.874 1.874 1.874 7.722
Thanks a lot! I'll stick with this method for this project. Thanks a lot to arun as well, for profiling different methods. ______________________________________________ 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.