findPersistentEnv: Find the persistent environment

Description Usage Details Value Author(s) See Also Examples

View source: R/findPersistentEnv.R

Description

Find the persistent environment inside a basiliskRun call, to allow variables to be passed across calls.

Usage

1

Details

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.

Value

An environment to which persistent variables can be assigned, for use in later basiliskRun calls on the same proc.

Author(s)

Aaron Lun

See Also

basiliskRun, where this function can be used.

Examples

1
2
3
4
5
6
7
8
9
# 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)

basilisk documentation built on Dec. 18, 2020, 2 a.m.