Re: [Rd] Editing a package with a NAMESPACE in place

From: Martin Maechler <maechler_at_stat.math.ethz.ch>
Date: Tue 06 Jun 2006 - 15:08:26 GMT

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

    Seth> Sean Davis <sdavis2@mail.nih.gov> writes:
>> On 6/6/06 8:33 AM, "Uwe Ligges"
>> <ligges@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@r-project.org mailing list     Seth> https://stat.ethz.ch/mailman/listinfo/r-devel

R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed Jun 07 02:36:22 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 06 Jun 2006 - 18:19:38 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.