Run code and capture the output
run_and_capture(
code,
echo = TRUE,
results = TRUE,
output = results,
capture_warnings = FALSE,
capture_messages = results,
muffle_warnings = FALSE,
muffle_messages = TRUE
)character vector or expression with the code to run
the code in code is repeated in the output.
include the results of running the code in the output.
include output that is explicitly written to the output, for
example using print statements.
include warnings in the output.
include messages in the output.
do not show warnings in the console.
do not show messages in the console.
Returns a list. Each item of the list contains a list with elements
input and output. input contains the command/code and
output the corresponding output. These are empty vectors when there is
no output or when input and output are suppressed using one of the
echo/results/output statements.