packageName

0th

Percentile

Find Package Associated with an Environment

Many environments are associated with a package; this function attempts to determine that package.

Keywords
utilities
Usage
packageName(env = parent.frame())
Arguments
env

The environment whose name we seek.

Details

Environment env would be associated with a package if topenv(env) is the namespace environment for that package. Thus when env is the environment associated with functions inside a package, or local functions defined within them, packageName will normally return the package name.

Not all environments are associated with a package: for example, the global environment, or the evaluation frames of functions defined there. packageName will return NULL in these cases.

Value

A length one character vector containing the name of the package, or NULL if there is no name.

See Also

getPackageName is a more elaborate function that can construct a name if none is found.

Aliases
  • packageName
Examples
library(utils) # NOT RUN { packageName() packageName(environment(mean)) # }
Documentation reproduced from package utils, version 3.6.1, License: Part of R 3.6.1

Community examples

Looks like there are no examples yet.