getSomewhere: Get an exported object by name, possibly from unattached...

Description Usage Arguments Value Examples

Description

A wrapper around get that allows using a qualified names like 'SomePackage::myFunc' to retrieve an object from a specific unattached (but loaded) package. Qualified names are recognized, parsed and then getFromNamespace is called instead ofget.

Usage

1

Arguments

x

An object name, as a string. May be qualified with a prefixed package:: identifier, in which case the object must be from that package. Unexported objects will not be found; looking for ::: qualified objects is an error.

...

Extra parameters (pos, envir, mode, inherits) to pass on to get). These are ignored if x is a qualified name, Other parameters will trigger an error, but only if x is an unqualified name. Since get is called from within a wrapper function in this package, these parameters will behave differently than if you called get directly.

Value

The object named. It is an error if the object is not found.

Examples

1
2
3
4
5
6
7
getSomewhere('ls')
#=> Returns base::ls, as base package is always loaded and attached.

try( getSomewhere('getAnywhere'))
#=> ERROR - utils::getAnywhere is not attached (it is loaded)
getSomewhere('utils::getAnywhere')
#=>

jefferys/DataRepo documentation built on May 19, 2019, 3:58 a.m.