Learn R Programming

evaluate

evaluate provides tools that allow you to recreate the parsing, evaluation and display of R code, with enough information that you can accurately recreate what happens at the command line. Evaluate + replay works very similarly to source(), but is written in such a way to make it easy to adapt for other output formats, such as html or latex.

library(evaluate)

There are three components to the evaluate package:

  • parse_all(), a version of parse that keeps expressions with their original source code, maintaining formatting and comments.
  • evaluate(), which evaluates each expression produced by parse_all(), tracking all output, messages, warnings, and errors as their occur, and interleaving them in the correct order with the original source and value of the expression.
  • replay(), which outputs these pieces in a way that makes it look like you've entered the code at the command line. This function also serves as a template for other output formats.

Copy Link

Version

Install

install.packages('evaluate')

Monthly Downloads

1,057,286

Version

1.0.1

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Last Published

October 10th, 2024

Functions in evaluate (1.0.1)

create_traceback

Generate a traceback from a list of calls
flush_console

An emulation of flush.console() in evaluate()
evaluate

Evaluate input and return all details of evaluation
trim_intermediate_plots

Trim away intermediate plots
evaluate-package

evaluate: Parsing and Evaluation Tools that Provide More Details than the Default
inject_funs

Inject functions into the environment of evaluate()
line_prompt

Line prompt.
try_capture_stack

Try, capturing stack on error
new_output_handler

Custom output handlers
local_reproducible_output

Control common output options
replay

Replay a list of evaluated results
is.message

Object class tests
set_hooks

Set and remove hooks
parse_all

Parse, retaining comments