Track User-Defined Environment Names

Set of functions to keep track of user-defined environment names (which cannot be retrieved with the built-in function environmentName()). The package also provides functionality to search for objects in environments, deal with function calling chains, and retrieve an object's memory address.

R package to retrieve the name of user-defined environments and of function execution environments.


The main goal of this package is to overcome the limitation of the built-in environmentName() function from the base package which does not return the name of an environment unless it is a package, a namespace or a system environment (e.g. the global environment, the base environment, the empty environment).

The envnames package solves this problem by creating a lookup table that maps environment names to their memory addresses. Using this lookup table, it is possible to retrieve the name of any environment where an object resides, be it a package, namespace, system environment, user-defined environment, or function execution environment.

See the following post as motivation for creating this package:


envnames 0.4.0 (26-Dec-2018)

Major changes

  • The Empty environment is now listed in the address-name lookup table created by get_env_names() and thus retrieved by the environment_name() function.
  • User environments defined in packages are now found (as long as they are exported), including environments nested in other user environments. In the previous release, only user environments defined in the global environment (or nested within other user environments) were found.

Minor changes

  • The locationaddress column of the address-name lookup table created by get_env_names() is now filled with the address of the location environment where user-defined environments live (instead of being equal to NA in those cases).
  • When setting the envir parameter of the obj_find() function to a non-NULL value, that envir environment is shown in the name of the environments where the searched object is found.

Bug fixes

  • Solved the problem of not finding user environments when their parent environment is the Empty environment.


  • Created a (visible) environment in the package (testenv) used to test package functionalities related to finding environments defined in packages.

envnames 0.3.0 (22-Jul-2018)

Initial submission to CRAN.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.4.0 by Daniel Mastropietro, 4 months ago

Report a bug at

Browse source code at

Authors: Daniel Mastropietro

Documentation:   PDF Manual  

GPL license

Suggests knitr, rmarkdown, testthat

See at CRAN