powered by
Evaluate expression and captures output as characters, then concatenate as one single string.
capture_expr(expr, collapse = "\n", type = c("output", "message"), ...)
R expression
character to concatenate outputs
passed to capture.output
capture.output
Character of length 1: output captured by capture.output
# NOT RUN { x <- data.frame(a=1:10) x_str <- capture_expr({ print(x) }) x_str cat(x_str) # }
Run the code above in your browser using DataLab