[R] modifying a built in function from the stats package (fixing arima)

Rolf Turner r.turner at auckland.ac.nz
Wed Mar 4 21:25:06 CET 2009


On 4/03/2009, at 10:06 PM, Marc Anonym wrote:

> Dear Carlos and Kjetil,
>
> Thanks for your answer.
>
>> I do not think that is the way to go. If you believe that your  
>> algorithm
>> is better than the existing one, talk to the author of the package  
>> and
>> discuss the improvement. The whole community will benefit.
>
> I should be able to *easily* modify it and test it first!
>
>> Copy the existing function into a new file, edit it and load it via
>> source.
>
>> 3)  after downloading the source package (stats) containung arima,
>>     rename it (my.arima) and then do the changes.
>
> I obviously saved it with a different name and I was expecting it  
> to work
> out of the box but I get an error that I don't know how to solve:
> Error in Delta %+% c(1, rep(0, seasonal$period - 1), -1) :
>   object "R_TSconv" not found
>
> Other people have previously discussed this in this list with no  
> success...
> http://www.nabble.com/Foreign-function-call-td21836156.html
>
> Any other hints or maybe help with the error that I'm getting?


If you ***look at the code*** for arima you will see that ``%+%'' is  
defined
in terms of a call to ``.Call()'' which calls ``R_TSconv''.  So  
apparently
R_TSconv is a C or Fortran function or subroutine in a ``shared  
object library''
or dll upon which arima depends.  Hence to do anything with it you'll  
need to get
that shared object library and dynamically load it.  (E.g. get the  
code, SHLIB it,
and dynamically load the resulting shared object library.)

The code is all available from the R source tarball.

If this is a challenge for you then the best advice would be not to  
mess with it.

I don't think that ***I'd*** mess with it, and I'm at least partially  
au fait with
this stuff.


		cheers,

			Rolf Turner

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}




More information about the R-help mailing list