Retrieve an R Object, Including from a Namespace

These functions locate all objects with name matching their argument, whether visible on the search path, registered as an S3 method or in a namespace but not exported. getAnywhere() returns the objects and argsAnywhere() returns the arguments of any objects that are functions.

a character string or name.

These functions look at all loaded namespaces, whether or not they are associated with a package on the search list.

They do not search literally anywhere: for example, local evaluation frames and namespaces that are not loaded will not be searched.

Where functions are found as registered S3 methods, an attempt is made to find which namespace registered them. This may not be correct, especially if namespaces have been unloaded.


  • For getAnywhere() an object of class "getAnywhere". This is a list with components
  • namethe name searched for
  • objsa list of objects found
  • wherea character vector explaining where the object(s) were found
  • visiblelogical: is the object visible
  • dupslogical: is the object identical to one earlier in the list.
  • In computing whether objects are identical, their environments are ignored.

    Normally the structure will be hidden by the print method. There is a [ method to extract one or more of the objects found.

    For argsAnywhere() one or more argument lists as returned by args.

See Also

getS3method to find the method which would be used: this might not be the one of those returned by getAnywhere since it might have come from a namespace which was unloaded or be registered under another name.

get, getFromNamespace, args

  • getAnywhere
  • argsAnywhere
  • [.getAnywhere
  • print.getAnywhere
library(utils) getAnywhere("format.dist") getAnywhere("simpleLoess") # not exported from stats argsAnywhere(format.dist)
Documentation reproduced from package utils, version 3.3, License: Part of R 3.3

Community examples

Looks like there are no examples yet.