| findPersistentEnv {basilisk} | R Documentation |
Find the persistent environment inside a basiliskRun call,
to allow variables to be passed across calls.
findPersistentEnv()
The persistent environment is where variables can be stored across basiliskRun calls.
When proc is an environment, it serves as the persistent environment;
otherwise, if proc is a process, the global environment of the process is the persistent environment.
It is very important that this function be called inside the frame of the FUN passed to basiliskRun.
It should not be called inside nested functions within FUN,
otherwise the look-up of the parent.frame will not work correctly.
Aaron Lun
basiliskRun, where this function can be used.
cl <- basiliskStart(NULL)
basiliskRun(proc=cl, function() {
assign(x="snake.in.my.shoes", 1, envir=basilisk::findPersistentEnv())
})
basiliskRun(proc=cl, function() {
get("snake.in.my.shoes", envir=basilisk::findPersistentEnv())
})
basiliskStop(cl)