Skip to content
Prev 85673 / 398502 Next

How to get the namespace of a function?

I think the issue in this case is the following aspect of UseMethod
from ?UseMethod:

    "'UseMethod' and 'NextMethod' search for methods in
     two places: first in the environment in which the generic function
     is called, and then in the registration data base for the
     environment in which the generic is defined"

Even if one is successful in calling a generic function such as index
from a function f with NULL environment UseMethod will look into
the environment within f (and not find it since its parent was set to
NULL) and since in this case the methods were not registered by the
package it does not find them in the package either.  This could have
worked somewhat more smoothly had the methods been registered.
On 2/2/06, Duncan Murdoch <murdoch at stats.uwo.ca> wrote: