evaluate | R Documentation |
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.
evaluate(
input,
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 = NULL,
filename = NULL,
include_timing = FALSE
)
input |
input object to be parsed and evaluated. May be a string, file
connection or function. Passed on to |
envir |
environment in which to evaluate expressions. |
enclos |
when |
debug |
if |
stop_on_error |
A number between 0 and 2 that controls what happens when the code errors:
|
keep_warning , keep_message |
A single logical value that controls what happens to warnings and messages.
Note that setting the envvar |
log_echo , log_warning |
If This will be force to |
new_device |
if |
output_handler |
an instance of |
filename |
string overrriding the |
include_timing |
Deprecated. |
evaluate(c(
"1 + 1",
"2 + 2"
))
# Not that's there's a difference in output between putting multiple
# expressions on one line vs spreading them across multiple lines
evaluate("1;2;3")
evaluate(c("1", "2", "3"))
# This also affects how errors propagate, matching the behaviour
# of the R console
evaluate("1;stop(2);3")
evaluate(c("1", "stop(2)", "3"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.