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

Gustaf Rydevik gustaf.rydevik at gmail.com
Thu Mar 5 10:17:30 CET 2009


On Thu, Mar 5, 2009 at 10:00 AM, Marc Anonym <manonym at acompany.com> wrote:
>>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.
>
> Hi Rolf,
> It took me some time to come to the same conclusion (I didn't even know what
> .Call() was) but I've found an easier way to modify the R file without
> having to understand how to link dlls. I just downloaded the full R package,
> Rtools and followed the instructions in
> http://cran.r-project.org/doc/manuals/R-admin.html#Building-the-core-files
> to build it. Then I can modify C:\R\src\library\stats\R\arima.R and run it.
> It is quite exagerated that I have to build R in order to modify an R file
> without messing with dlls, and I think it would be interesting to make this
> process easier, but for now I'm happy to be productive again.
>
> Thank you all for your help,
>
> Best,
> MarC
>


Just a quick note on your original question:
if you use edit(arima), you have to remember that it returns the
modified function, which then must be stored.

I.e, use
arima<-edit(arima)

instead of just

edit(arima)

,and changes should be stored.

Regards,

Gustaf

-- 
Gustaf Rydevik, M.Sci.
tel: +46(0)703 051 451
address:Essingetorget 40,112 66 Stockholm, SE
skype:gustaf_rydevik




More information about the R-help mailing list