From ripley at stats.ox.ac.uk  Wed Nov  7 22:15:03 2012
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Wed, 07 Nov 2012 21:15:03 +0000
Subject: [Rd] alternative to .Fortran("dqrls", ...)
In-Reply-To: <0D8B0CF6466B4BBB90D28169EF30BB69@science.oregonstate.edu>
References: <509A240B.3050308@jrc.ec.europa.eu><7FF8666C-81E1-46FB-8B87-583726314989@r-project.org><D1BE25EA-2FE3-4744-A10F-3B831258AF89@r-project.org><73d0dce76a2f.509aadd2@jrc.ec.europa.eu>
	<509ABDC3.9030801@stats.ox.ac.uk>
	<0D8B0CF6466B4BBB90D28169EF30BB69@science.oregonstate.edu>
Message-ID: <509ACF57.80801@stats.ox.ac.uk>

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



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