Evaluates code
in a special context in which all output is captured,
similar to capture.output()
.
capture_output(code, print = FALSE, width = 80)capture_output_lines(code, print = FALSE, width = 80)
Code to evaluate.
If TRUE
and the result of evaluating code
is
visible this will print the result, ensuring that the output of printing
the object is included in the overall output
Number of characters per line of output
capture_output()
returns a single string. capture_output_lines()
returns a character vector with one entry for each line
# NOT RUN {
capture_output({
cat("Hi!\n")
cat("Bye\n")
})
capture_output_lines({
cat("Hi!\n")
cat("Bye\n")
})
capture_output("Hi")
capture_output("Hi", print = TRUE)
# }
Run the code above in your browser using DataLab