evaluate: Evaluate input and return all details of evaluation.

View source: R/eval.R

evaluateR Documentation

Evaluate input and return all details of evaluation.


Compare to eval(), evaluate captures all of the information necessary to recreate the output as if you had copied and pasted the code into a R terminal. It captures messages, warnings, errors and output, all correctly interleaved in the order in which they occured. It stores the final result, whether or not it should be visible, and the contents of the current graphics device.


  envir = parent.frame(),
  enclos = NULL,
  debug = FALSE,
  stop_on_error = 0L,
  keep_warning = TRUE,
  keep_message = TRUE,
  log_echo = FALSE,
  log_warning = FALSE,
  new_device = TRUE,
  output_handler = default_output_handler,
  filename = NULL,
  include_timing = FALSE



input object to be parsed and evaluated. May be a string, file connection or function. Passed on to parse_all().


environment in which to evaluate expressions.


when envir is a list or data frame, this is treated as the parent environment to envir.


if TRUE, displays information useful for debugging, including all output that evaluate captures.


if 2, evaluation will halt on first error and you will get no results back. If 1, evaluation will stop on first error without signaling the error, and you will get back all results up to that point. If 0 will continue running all code, just as if you'd pasted the code into the command line.

keep_warning, keep_message

whether to record warnings and messages; if FALSE, messages will be suppressed; if NA, they will not be captured (normally they will be sent to the console). Note that if the environment variable R_EVALUATE_BYPASS_MESSAGES is set to true, these arguments will always be set to NA, meaning that messages will not be captured by this function.

log_echo, log_warning

If TRUE, will immediately log code and warnings (respectively) to stderr.


if TRUE, will open a new graphics device and automatically close it after completion. This prevents evaluation from interfering with your existing graphics environment.


an instance of output_handler() that processes the output from the evaluation. The default simply prints the visible return values.


string overrriding the base::srcfile() filename.


if TRUE, evaluate will wrap each input expression in system.time(), which will be accessed by following replay() call to produce timing information for each evaluated command.

evaluate documentation built on Nov. 2, 2023, 5:18 p.m.