devtools (version 1.10.0)

eval_clean: Evaluate code in a clean R session.

Description

Evaluate code in a clean R session.

Usage

eval_clean(expr, quiet = TRUE)

evalq_clean(expr, quiet = TRUE)

Arguments

expr
an R expression to evaluate. For eval_clean this should already be quoted. For evalq_clean it will be quoted for you.
quiet
if TRUE, the default, only the final result and the any explicitly printed output will be displayed. If FALSE, all input and output will be displayed, as if you'd copied and paste the code.

Value

  • An invisible TRUE on success.

Examples

Run this code
x <- 1
y <- 2
ls()
evalq_clean(ls())
evalq_clean(ls(), FALSE)
eval_clean(quote({
  z <- 1
  ls()
}))

Run the code above in your browser using DataCamp Workspace