[Rd] alternative to .Fortran("dqrls", ...)

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Nov 7 22:15:03 CET 2012


On 07/11/2012 20:26, Yanming Di wrote:
> Hi all,
>
> In a package I maintain, I use the "dqrls" from the base package to fit
> regression models. However, I was informed that directly calling
> functions from the base package is no longer allowed:
>
> "CRAN packages should use only the public API. Hence they should not use
> entry points not declared as API in installed headers nor .Internal()
> nor .Call() etc calls to base packages. Such usages can cause packages
> to break at any time, even in patched versions of R."

And dqrls is no longer available via .Fortran in R-devel.

> Prof. Ripley suggested that one can replace such calls with lm.wfit,
> which will work.
>
> However, in my package, the call will need to be implemented hundreds of
> thousands times. Using lm.wfit is much slower. I am wondering whether
> there is alternative ways that are more efficient. I can program in C if
> needed.

If the licence of your package allows it, you can copy the Fortran code 
into your package and write your own interface via .Fortran, .C or .Call.

The .Fortran interface is itself quite costly, especially in R < 2.15.1: 
in some cases lm.wfit is actually faster as it uses .Call.

>
> Many thanks.
>
> Best regards,
> Yanming
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list