Programmers often use several small functions inside large functions. Along the way, we can collect things in the environment for later use. We could create an environment with new.env(hash=FALSE)
and pass it along with smaller functions and assign with assign
. Well, dandy. I was wondering if we can use the reference identifier of the environment, and not pass it to child functions, but still we assign the link to the environment ID to the environment.
So i do
myenv <- new.env(hash=FALSE)
## <environment: 0x00000000588cc918>
And how typical it would be possible to appropriate it if I transferred child functions of the environment.
assign("elem1", 35, myenv)
myenv[["elem1"]]
# 35
I want to make an environment in the parent function and pass the reference identifier instead, so I want to do something like:
assign("elem2", 123, "0x00000000588cc918")
But the result is predictable:
#
#
? , , ... , , .
.