On 10/3/2006 2:22 PM, Erik Iverson wrote: > Hello - > > I'm currently maintaining an R package that uses a name space, and am > also starting a new R package that will use a name space. > > According the the R News June 2003 issue, "Adding a name space to a > package may complicate debugging code ... it is a good idea not to add a > name space to a package until it is completely debugged, and to remove > the name space if further debugging is needed ... other alternatives are > being explored ... ". > > Is renaming/removing the NAMESPACE file still the favored approach when > developing and debugging code for an R package? > > I suppose the alternative I have in mind is something like sourcing an R > file, and using assignInNamespace(), may be more trouble than it is worth. > > I am doing this development using ESS by the way. >
It depends on the type of debugging you're doing. The reason for that suggestion is that usually when you edit a new function, it will live in the global environment, rather than the namespace. This means it won't see objects in the namespace, and they'll see a local copy before they see it. You can make it see things there by setting its environment to be the namespace. I always forget the syntax for that, so I usually do something like environment(newfn) <- environment(someexportedfn) Note that if you use fix(), the environment is automatically preserved, but you'll still create your new copy in the global environment. To let other functions see it, you need to use assignInNamespace(). Duncan Murdoch ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel