[R] Package design, placement of legacy functions

Martin Maechler maechler at stat.math.ethz.ch
Mon Jul 23 14:24:01 CEST 2007


>>>>> "WA" == William Asquith <wasquith at austin.rr.com>
>>>>>     on Sun, 22 Jul 2007 13:29:24 -0500 writes:

    WA> I have a function XOLD() from a nearly verbatim port of legacy  
    WA> FORTRAN in a package. I have remplemented this function as XNEW()  
    WA> using much cleaner native R and built-in functions of R. I have  
    WA> switched the package to the XNEW(), but for historical reasons would  
    WA> like to retain the XOLD() somewhere in the package directory  
    WA> structure. An assertion through a README or other will point to this  
    WA> historical function and the output from the two should be numerically  
    WA> equal.

    WA> Placement in package/R is not an option as XOLD() no longer  
    WA> constitutes a true user level function, would package/inst/legacyR or  
    WA> something like that be suitable to the R community?

Yes, put it somewhere inside <pkg>/inst/
(and end the filename in *.R).

A user of your **installed** package will be able
to use
	system.file("legacy.R", package = "<pkg")
e.g.,
as	source(system.file("legacy.R", package = "<pkg"))

    WA> Thanks for the guidance. . .

you're welcome.
Martin Maechler, ETH Zurich



More information about the R-help mailing list