View source: R/environment_name.R
environment_name | R Documentation |
Get the name of an environment
environment_name(envir)
envir |
An |
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)
.
A non-empty character string.
environment_name(emptyenv()) ## "R_EmptyEnv"
environment_name(globalenv()) ## "R_GlobalEnv"
environment_name(baseenv()) ## "package:base"
environment_name(.BaseNamespaceEnv) ## "base"
environment_name(getNamespace("base")) ## "base"
environment_name(getNamespace("utils")) ## "utils"
environment_name(new.env()) ## e.g. "0x55ff679a1ce0"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.