ID EN
Data Types & Classes

as.environment

R Base 3.6.2 🇮🇩 Bahasa Indonesia

Fungsi generik yang memaksa objek R ke suatu lingkungan. Nomor atau string karakter dikonversi ke lingkungan yang sesuai di jalur pencarian.

Syntax

R
as.environment(x)

Arguments

Parameter Deskripsi
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 -1, the environment it is called from. If it is a character string, match the string to the names on the search list. If it is a list, the equivalent of list2env(x, parent = emptyenv()) is returned. If is.object(x) is true and it has a class for which an as.environment method is found, that is used.

Return Value

Objek lingkungan yang sesuai.

Contoh

Example
R
# NOT RUN {
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)
# }

See Also

environment for creation and manipulation search; list2env.