[R] Help with error on function: Error in .... attempt to apply non-function
Dear R gurrus, I wrote this function http://scsys.co.uk:8002/33852?ln=onstore=onsubmit=Format+it! for a small package I am preparing. Whenever I run the function I get the error Error in Mspline(i = i, x = x, degree = kk, t = t) : attempt to apply non- function Anyone could point me out what I am doing wrong? kubuntu 904 64 bit, R 2.9.2 Regards -- Corrado Topi Global Climate Change Biodiversity Indicators Area 18,Department of Biology University of York, York, YO10 5YW, UK Phone: + 44 (0) 1904 328645, E-mail: ct...@york.ac.uk __ R-help@r-project.org mailing list 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.
Re: [R] Help with error on function: Error in .... attempt to apply non-function
Corrado wrote: Dear R gurrus, I wrote this function http://scsys.co.uk:8002/33852?ln=onstore=onsubmit=Format+it! for a small package I am preparing. Whenever I run the function I get the error Error in Mspline(i = i, x = x, degree = kk, t = t) : attempt to apply non- function Anyone could point me out what I am doing wrong? It would be a lot easier to do so if you gave us a reproducible example. But the usual cause for that is using () instead of [], or forgetting an operator. I think you've done the second: you have (k-1)(t[i+k]-t[i]) where you should have (k-1)*(t[i+k]-t[i]). Duncan Murdoch __ R-help@r-project.org mailing list 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.
Re: [R] Help with error on function: Error in .... attempt to apply non-function
Dear Duncan, this is a reproducible example: it is the function copied straight from my Eclipse. I found the mistake (thanks to Peter) On Tuesday 15 September 2009 11:15:29 Duncan Murdoch wrote: Corrado wrote: Dear R gurrus, I wrote this function http://scsys.co.uk:8002/33852?ln=onstore=onsubmit=Format+it! for a small package I am preparing. Whenever I run the function I get the error Error in Mspline(i = i, x = x, degree = kk, t = t) : attempt to apply non- function Anyone could point me out what I am doing wrong? It would be a lot easier to do so if you gave us a reproducible example. But the usual cause for that is using () instead of [], or forgetting an operator. I think you've done the second: you have (k-1)(t[i+k]-t[i]) where you should have (k-1)*(t[i+k]-t[i]). Duncan Murdoch -- Corrado Topi Global Climate Change Biodiversity Indicators Area 18,Department of Biology University of York, York, YO10 5YW, UK Phone: + 44 (0) 1904 328645, E-mail: ct...@york.ac.uk __ R-help@r-project.org mailing list 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.
Re: [R] Help with error on function: Error in .... attempt to apply non-function
On 15/09/2009 6:32 AM, Corrado wrote: Dear Duncan, this is a reproducible example: it is the function copied straight from my Eclipse. - You posted it in a way that couldn't be cut and pasted into R: you added line numbers. (A similar problem is when people use print() to show a dataset; it's not easy to get one of those into a new session. Show us the source code to generate the example instead.) - You didn't give the calling sequence so I could just cut and paste the code into R and see the error. So even if I took the time to turn off the line numbers, I would have to spend time figuring out what inputs you used. I found the mistake (thanks to Peter) But you didn't describe it so no one else can learn from it. Duncan Murdoch On Tuesday 15 September 2009 11:15:29 Duncan Murdoch wrote: Corrado wrote: Dear R gurrus, I wrote this function http://scsys.co.uk:8002/33852?ln=onstore=onsubmit=Format+it! for a small package I am preparing. Whenever I run the function I get the error Error in Mspline(i = i, x = x, degree = kk, t = t) : attempt to apply non- function Anyone could point me out what I am doing wrong? It would be a lot easier to do so if you gave us a reproducible example. But the usual cause for that is using () instead of [], or forgetting an operator. I think you've done the second: you have (k-1)(t[i+k]-t[i]) where you should have (k-1)*(t[i+k]-t[i]). Duncan Murdoch __ R-help@r-project.org mailing list 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.
Re: [R] Help with error on function: Error in .... attempt to apply non-function (Solution)
Dear friends, the problem with the error has been solved (thanks to Peter). The line 41 in http://scsys.co.uk:8002/33852 should be rewritten as M-k*((x-t[i])*m0+(t[i+k]-x)*m1)/((k-1)*(t[i+k]-t[i])) On Tuesday 15 September 2009 11:32:53 Corrado wrote: -- Corrado Topi Global Climate Change Biodiversity Indicators Area 18,Department of Biology University of York, York, YO10 5YW, UK Phone: + 44 (0) 1904 328645, E-mail: ct...@york.ac.uk __ R-help@r-project.org mailing list 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.