>>>>> jim holtman <jholt...@gmail.com> >>>>> on Sun, 22 May 2016 16:47:06 -0400 writes:
> if you want to use 'ifelse', here is a way: hmm, why should he want that ? The OP did mention that it's about somewhat large objects, so efficiency is one of the considerations : ifelse() is often convenient and nicely self-explaining, but it is (because of its generality, but also by its definition) much *less efficient* than the (sometimes slightly less convenient) ways you were shown previously in this thread : - For the generalized case findInterval() is order of magnitudes better, and - for the simple case you were shown to use logical indexing, i.e., calls à la x[x > k] <- .. In summary: Use ifelse() much less -- notably if writing functions/code which should scale ! Martin Maechler ETH Zurich ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.