sVariable defines a function that acts as a global static variable.

sVariable(default = NULL)

Arguments

default

default value for the static variable.

Examples

# define variable x <- sVariable(1) # get value (default) x()
#> [1] 1
# set new value: return old value old <- x(3) old
#> [1] 1
# get new value x()
#> [1] 3