environment_name.RdGet the name of an environment
environment_name(envir)An environment.
A non-empty character string.
This function returns what
environmentName(envir) with a few
exceptions.  One exception is that it, instead of "base", returns
"package:base" for baseenv(), which is the same environment as
pos.to.env(grep("package:base", search())).  This distinguishes
from "base" returned for getNamespace("base"), which is not
the same environment.  Another exception is when environmentName()
returns an empty string, e.g. when envir <- new.env().  In such cases,
it returns the hexadecimal string that is outputted by print(envir).
environment_name(emptyenv())             ## "R_EmptyEnv"
#> [1] "R_EmptyEnv"
environment_name(globalenv())            ## "R_GlobalEnv"
#> [1] "R_GlobalEnv"
environment_name(baseenv())              ## "package:base"
#> [1] "package:base"
environment_name(.BaseNamespaceEnv)      ## "base"
#> [1] "base"
environment_name(getNamespace("base"))   ## "base"
#> [1] "base"
environment_name(getNamespace("utils"))  ## "utils"
#> [1] "utils"
environment_name(new.env())              ## e.g. "0x55ff679a1ce0"
#> [1] "0x58264cdce228"