Re: [R] approxfun returning value higher than I would expect

2010-09-16 Thread Duncan Murdoch
stephen sefick wrote: I will get R-dev tomorrow, and give it a try. Where do I check out the svn? https://svn.r-project.org/R/trunk The fixed files are in .../src/library/stats/R and are approx.R, spline.R and splinefun.R. The only one that affects your report is approx.R. Duncan Murd

Re: [R] approxfun returning value higher than I would expect

2010-09-15 Thread stephen sefick
I will get R-dev tomorrow, and give it a try. Where do I check out the svn? thanks, Stephen On Wed, Sep 15, 2010 at 10:00 PM, Duncan Murdoch wrote: > I think this is fixed now.  There were actually two bugs: > > I fixed an old one a few days ago, but my fix didn't handle the case of > unsorted

Re: [R] approxfun returning value higher than I would expect

2010-09-15 Thread Duncan Murdoch
I think this is fixed now. There were actually two bugs: I fixed an old one a few days ago, but my fix didn't handle the case of unsorted x properly. (I haven't checked whether the old code handled that properly; I'd guess not, but it might have.) Now I've fixed my new bug. *Please* test

Re: [R] approxfun returning value higher than I would expect

2010-09-15 Thread stephen sefick
x <- c(-0.48,-0.48,-0.42,-0.26,0.58,0.48,0.47,0.54,0.5,0.52,0.52,0.56,0.58,0.61,0.68) y <- c(0,0.2,0.4,0.6,0.8,1,1.2,1.4,1.6,1.8,2,2.2,2.4,2.6,2.8) s <- approxfun(x[4:5], y[4:5], ties=mean) s(0) #This is the value that I want. The first zero crossing in the order of y. #In other words in betw

Re: [R] approxfun returning value higher than I would expect

2010-09-15 Thread stephen sefick
Thanks and I'll strip the code down even more in future posts. Stephen On Wed, Sep 15, 2010 at 3:05 PM, Duncan Murdoch wrote: >  On 15/09/2010 3:48 PM, stephen sefick wrote: >> >> Below is the code that I am using in a much larger function.  I would >> expect a bankfull measure at zero to be bet

Re: [R] approxfun returning value higher than I would expect

2010-09-15 Thread Duncan Murdoch
On 15/09/2010 3:48 PM, stephen sefick wrote: Below is the code that I am using in a much larger function. I would expect a bankfull measure at zero to be between 0.6 and 0.8 approxfun is returning 0.8136986. I am sure that I am missing something. measure_bkf<- (structure(list(measurment_num =

[R] approxfun returning value higher than I would expect

2010-09-15 Thread stephen sefick
Below is the code that I am using in a much larger function. I would expect a bankfull measure at zero to be between 0.6 and 0.8 approxfun is returning 0.8136986. I am sure that I am missing something. measure_bkf <- (structure(list(measurment_num = c(0, 0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8