2
我无法摆脱我失去一些明显的东西的感觉。有没有更清晰或更习惯的方式去做以下功能?找到符合条件的最小值的更好方法?
closest.preceding <- function(candidates, limit) {
# return the value in candidates that is closest to but less than the limit
return(limit - min(limit-candidates[candidates < limit]))
}
感谢您的任何见解。
我很确定这是我的狂热大脑试图让我去做的事情。谢谢! – Patrick 2012-03-07 05:14:19