stash: Stash and Unstash Modules. List and Remove Stashes.

View source: R/stash.R

stashR Documentation

Stash and Unstash Modules. List and Remove Stashes.

Description

Stash and unstash all modules and internal state. List and remove stashes.

Usage

stash(comment = NA_character_)

unstash(id = length(.modulr_env$injector$stash))

list_stashes()

remove_stash(id, all)

Arguments

comment

A string (character vector of length one).

id

A scalar (integer vector of length one).

all

A flag. Should all stashes be removed?

Details

stash allows to stash all modules and the internal state of modulr. Each stash is pushed on a stack and can be commented for later reference. unstash pops a stash from the stack and restores the state accordingly. list_stashes lists the stack, showing ids, timestamps and comments for each stash. remove_stash removes one or all stashes from the stack.

Value

A scalar (integer vector of length one) containing the stash ID.

Warning

It is considered a very bad practice to define, touch, undefine, load, make, reset, or perform any other operation from within a module definition that may alterate the internal state of modulr.

See Also

define, list_modules, and reset.

Examples

reset()
remove_stash(all = TRUE)
define("foo", NULL, function() NULL)
stash("'foo' only")
list_stashes()
define("bar", NULL, function() NULL)
stash("'foo' and 'bar'")
list_stashes()
list_modules()
unstash(1L)
list_modules()


aclemen1/modulr documentation built on Oct. 2, 2024, 7:18 a.m.