pos.to.env(x)
x | an integer value, or a vector of integer values. x is limited to the number of environments present in the search() list, plus environment: R_EmptyEnv. |
name | the package name corresponding to environment. For example: "package:graphics" |
path | the absolute path of a package corresponding to environment. For example: "C:/xxxx/library/graphics" |
pos.to.env(1:5)pos.to.env(4)
pos.to.env(10) # <environment: R_EmptyEnv>
pos.to.env(.GlobalEnv) # Error: environments cannot be coerced to other types
pos.to.env(c(1, 2, 3))
pos.to.env(-1) # Error in pos.to.env(-1) : no enclosing environment
f <- function() { pos.to.env(-1) } f() # <environment: R_GlobalEnv>
pos.to.env(0) # Error in pos.to.env(0) : invalid argument
pos.to.env(10) # <environment: R_EmptyEnv>
pos.to.env(11) # Error in pos.to.env(11) : invalid argument
# Passing a list object. pos.to.env(list(a = c(1:3), b = c(4:5))) # Error: (list) object cannot be coerced to type 'integer'