mtrace
.fun.locator( fname, from=.GlobalEnv)
.GlobalEnv
fname
was found, of length 0 if no copies were found. First, any environments between from
and topenv( from)
are searched (normally, this means temporary frames wherein fname
could have been defined; but see DETAILS). Next, the search list is checked. Next, all loaded namespaces are checked. Finally, all S3 method tables are checked.fname
is defined in a namespaced package foo
exports fname
, then fname
will be found both in the search path (in package:foo
) and in the "hidden" environment asNamespace( "foo")
. The first version will be found by "normal" calls to fname
, but the hidden version will be found whenever fname
is invoked by a function in package:foo
. If the S3 method somegeneric.fname
is defined in package:foo
, then it will exist both in asNamespace("foo")
and in get( ".__S3MethodsTable__.", asNamespace( "foo"))
, although not in the main search path. If fname
is both exported and an S3 method, then there will be three copies. All such duplicates should probably be identical, and if you want to change any one copy, you probably want to change all of them.
Normally, the search path environment(s) where fname
is found will be given before (i.e. with lower index than) the hidden namespace environment. However, if from
is used to start the search in a hidden namespace environment where fname
exists, then the hidden namespace will be returned first. Duplicated environments are removed from the return list.
I don't know what happens with S4-style methods.getAnywhere