I've just spent today trying to fix a Heisenbug...
this function returns a linear interpolator function:
interpOne - function(xl,yl){
f = function(data){
t = (data-min(xl))/(max(xl)-min(xl))
return(min(yl)+t*(max(yl)-min(yl)))
}
return(f)
}
k=interpOne(c(0,1),c(4,5))
k(0.5)
[1]
On 22/05/2009 3:02 PM, Barry Rowlingson wrote:
On Fri, May 22, 2009 at 6:04 PM, Duncan Murdoch murd...@stats.uwo.ca wrote:
Putting force(xl); force(yl) into your interpOne definition (so they get
executed when interpOne is called, not just when the returned function is
called) should work.