Date: Tue, 7 Apr 1998 09:54:40 +0200 Message-Id: <199804070754.JAA00502@sophie.ethz.ch> From: Martin Maechler <maechler@stat.math.ethz.ch> To: jlindsey@luc.ac.be Subject: Re: R-beta: spline problems(?) >>>>> "Jim" == Jim Lindsey <jlindsey@luc.ac.be> writes: Jim> I suspect that this is a problem that I pointed out some time ago Jim> with integers. seq and : produce integers and the C code of spline Jim> is expected doubles. Try as.double() around your 1:nrow(y) and Jim> seq() calls to see if the problem goes away. Jim Jim, this was exactly my own first suspicion, also. But it's wrong. spline(.) uses xy.coord(.) [[a very useful thing! use it in your own functions!!]] and xy.coord(.) ends in return(list(x = as.real(x), y = as.real(y), xlab = xlab, ylab = ylab)) which ensures that integers are coerced to real (== double in R). It must be rather another problem, as Ross already mentioned, and is investigating himself. Martin Tasos> Hi, Tasos> Tasos> I am a total beginner with this whole thing so please have patience! Tasos> Tasos> I am trying to run an S-plus program with a certain line: Tasos> spline(1:nrow(y), y[,1],n=100); Tasos> Tasos> This crashes with: Error: NAs in foreign function call (arg 8) Tasos> Tasos> Apparently, this is caused by the last command of spline: u <- Tasos> seq(xmin, xmax, length.out = n) .C("spline_eval", z$method, Tasos> length(u), x = u, y = double(n), z$n, z$x, z$y, z$b, z$c, Tasos> z$d)[c("x", "y")] } Tasos> Tasos> Now, I can cause that error with: spline(1:10,1:10) So, there is a Tasos> whole class of problems for which spline refuses to compute anything Tasos> - is this the correct behaviour? E.g., spline(1:10,(1:10)/2.5) #it Tasos> is alright, but ... spline(1:10,(1:10)/2) # this has the "NAs.." Tasos> problem Tasos> Tasos> Finally, I am almost sure that the y matrix in my program has quite Tasos> normal values, i.e. values that should allow for meaningful Tasos> interpolation. Anybody knows what this all is about? Tasos> Tasos> Thanks, Tasos> Tasos> Tasos T. -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._