Description Usage Arguments Value Note Author(s) See Also Examples
A generic function coercing an R object to an
environment
. A number or a character string is
converted to the corresponding environment on the search path.
1 |
x |
an R object to convert. If it is already an
environment, just return it. If it is a positive number, return the
environment corresponding to that position on the search list. If it
is If it is a list, the equivalent of If |
The corresponding environment object.
This is a primitive function.
John Chambers
environment
for creation and manipulation,
search
; list2env
.
1 2 3 4 5 6 7 | as.environment(1) ## the global environment
identical(globalenv(), as.environment(1)) ## is TRUE
try( ## <<- stats need not be attached
as.environment("package:stats"))
ee <- as.environment(list(a = "A", b = pi, ch = letters[1:8]))
ls(ee) # names of objects in ee
utils::ls.str(ee)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.