View source: R/defaultVarInfoHelpers.R
getPromiseVar | R Documentation |
Gets a representation of a promise without forcing the promise
getPromiseVar(name, env)
name |
The name of the variable |
env |
The environment in which to evaluate |
An object of class .vsc.promise
or .vc.promiseDetails
,
depending on the option vsc.showPromiseDetails
.
The two classes are functionally identical and only rendered differently.
A named list containing the expression that will be evaluated,
the status whether the promise has already been evaluated,
the value if it has already been evaluated,
and the environment in which the unevaluated promise will be evaluated.
## create a promise
e <- new.env()
delayedAssign("x", {message("evaluating promise..."); 1L}, assign.env = e)
vscDebugger:::getPromiseVar("x", e)
## evaluate it...
base::print(e$x)
## is it still a promise? (It depends...)
stopifnot(vscDebugger:::isPromise("x", e, strict = FALSE))
stopifnot(!vscDebugger:::isPromise("x", e, strict = TRUE))
## get info again
vscDebugger:::getPromiseVar("x", e)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.