Environments in R can be explicitly call and named. Variables can be explicitly assigned and call to or from those environments.
A commonly created environment is one which encloses package:base or a subenvironment within package:base.
e1 <- new.env(parent = baseenv())
e2 <- new.env(parent = e1)
Variables can be explicitly assigned and call to or from those environments.
assign("a", 3, envir = e1)
get("a", envir = e1)
get("a", envir = e2)
3
3
Since e2 inherits from e1, a is 3 in both e1 and e2. However, assigning a within e2 does not change the value of a in e1.
assign("a", 2, envir = e2)
get("a", envir = e2)
get("a", envir = e1)
3
2