[Rd] Editing a package with a NAMESPACE in place

Martin Maechler maechler at stat.math.ethz.ch
Tue Jun 6 17:08:26 CEST 2006


>>>>> "Seth" == Seth Falcon <sfalcon at fhcrc.org>
>>>>>     on Tue, 06 Jun 2006 07:31:22 -0700 writes:

    Seth> Sean Davis <sdavis2 at mail.nih.gov> writes:
    >> On 6/6/06 8:33 AM, "Uwe Ligges"
    >> <ligges at statistik.uni-dortmund.de> wrote:
    >> 
    >>> See ?assignInNamespace and ?fixInNamespace
    >>  Thanks, Uwe.  I should have been able to find those,
    >> but....
    >> 
    >>> During developing, I suggest to remove the NAMESPACE
    >>> temporarily.
    >>  I wondered if that was common practice.

    Seth> For simple packages, removing the NAMESPACE file will
    Seth> work well and is certainly very convenient.  However,
    Seth> with more complex packages (in terms of dependencies
    Seth> and S4 stuff) it may not work so well:

    Seth> * You won't be testing the _real_ package (this is a
    Seth> problem regardless of complexity I suppose).

    Seth> * Without the NAMESPACE, you may get the wrong
    Seth> functions and see all sorts of breakage.  IOW, some
    Seth> packages rely on the NAMESPACE to function properly;
    Seth> removing it does more than just exposing private
    Seth> functions.

    Seth> In practice I tend not to follow my advice :-/.  What
    Seth> I often do is the equivalent of source() on the
    Seth> required .R files while I'm fixing a particular
    Seth> function or method.  But I do make sure to go through
    Seth> an INSTALL/test cycle (with NAMESPACE) frequently.

I'm quite similar to Seth here. For that reason (and because
Doug Bates also behaves similarly here, and we talked about it !),
if you use  R 2.3.0 or newer,
    example(source)
will provide the function  sourceDir(),  so you can do

   example(source)
   sourceDir("<mypackage_SOURCE_dir>/R")

Martin 



    Seth> Cheers,

    Seth> + seth

    Seth> ______________________________________________
    Seth> R-devel at r-project.org mailing list
    Seth> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list