If env is an environment it is searched for in the envir environment using its memory address.
If env is a string containing a valid 16-digit memory address (enclosed in < >), the memory address
itself is searched for among the defined environments in the envir environment.
In both cases, if envir=NULL the search is carried out in the whole workspace.
It may happen that more than one environment exist with the same memory address (for instance
if an environment is a copy of another environment). In such case, if matchname=FALSE,
the names of ALL the environments matching env's memory address are returned. Otherwise,
only the environments matching the given name are returned.
If envmap is passed it should be a data frame providing an address-name pair lookup table
of environments and should contain at least the following columns:
location for user-defined environments, the name of the environment where the environment
is located; otherwise NA.
pathname the full environment path to reach the environment separated by $
(e.g. "env1$env$envx")
address an 8-digit (32-bit architectures) thru 16-digit (64-bit architectures) memory address
of the environment given in pathname enclosed in < > (e.g. "<0000000007DCFB38>"
(64-bit architectures))
Be ware that Linux Debian distributions may have a 12-digit memory address representation.
So the best way to know is to check a memory address by calling e.g. `address("x")`.
Passing an envmap lookup table is useful for speedup purposes, in case several calls to this
function will be performed in the context of an unchanged set of defined environments.
Such envmap data frame can be created by calling get_env_names.
Use this parameter with care, as the matrix passed may not correspond to the actual mapping of existing
environments to their addresses and in that case results may be different from those expected.
The following example illustrates the use of the ignore parameter:
for (e in c(globalenv(), baseenv())) { print(environment_name(e, ignore="e")) }
That is, we iterate on a set of environments and we don't want the loop variable (an environment itself)
to show up as part of the output generated by the call to environment_name().