Skip to content
Prev 22256 / 63424 Next

developing a package with a name space

On 10/3/2006 2:22 PM, Erik Iverson wrote:
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