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.
Developers should avoid naming persistent variables with the .basilisk
prefix.
These are reserved for internal use and may be overwritten by later calls to basiliskRun
.
An environment to which persistent variables can be assigned,
for use in later basiliskRun
calls on the same proc
.
Aaron Lun
basiliskRun
, where this function can be used.
# Using the base environment for brevity. 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)