getAnywhere
Search Packages, Namespaces, and S3 Methods

Description

Searches attached packages, loaded namespaces, and S3 methods for a given name.

Usage

getAnywhere(x)
argsAnywhere(x)
## S3 method for class 'getAnywhere':
x[i]
## S3 method for class 'getAnywhere':
print(x, ...)

Arguments

x
  • In getAnywhere or argsAnywhere, a character string representing the object to be retrieved. If it is not a string, then the unevaluated argument expression is converted to a character string.
  • In the S3 methods for "[" or print, x is an object of class "getAnywhere".
i a single integer or an integer vector giving the indices of the elements to extract.
... other arguments passed to the print method. Reserved for future use.

Details

Value

getAnywherereturns a list object of class "getAnywhere" with the following components:
name The string name given by x.
objs A list of found objects with the name x
where A string vector giving location information of the found objects in objs.
visible A logical vector specifying whether the found objects are exported from the package or name space.
dups A logical vector specifying which of the found objects are identical to an earlier one in the objs list. For found objects that are functions, functions with the same body but different environments are considered to be different (in TERR, but not in R).
argsAnywherereturns a single value (as returned by the args function), or a list of such values if there are multiple found objects. If no objects are found, it returns NULL.
[.getAnywherereturns the i-th element from the objs component if i is given as a single number, or a list extracting the indices i from objs if it is not a single number.
print.getAnywherereturns x itself invisibly.
See Also
get, find, getS3method, loadedNamespaces, exist, args
Examples
## exported in package:base, also in namespace, and S3 method
(res <- getAnywhere("print.default") )
res$visible  # TRUE FALSE FALSE
res$dups  # FALSE TRUE TRUE
res[1] # extract the 1st object only
res[2:3] # extract the 2nd and 3rd objects

## not exported, in namespace and S3 method only getAnywhere("print.raster")

## if x is not a string, the unevaluated argument is converted to a string getAnywhere(print.default)

## finds both functions and regular variables factor <- factor(1:6) getAnywhere("factor")

## print function args argsAnywhere("print.default")

Package utils version 6.1.1-7
Package Index