capture_expr: Captures Evaluation Output of Expressions as One Single...

Description Usage Arguments Value Examples

View source: R/strings.R

Description

Evaluate expression and captures output as characters, then concatenate as one single string.

Usage

1
capture_expr(expr, collapse = "\n", type = c("output", "message"), ...)

Arguments

expr

R expression

collapse

character to concatenate outputs

type, ...

passed to capture.output

Value

Character of length 1: output captured by capture.output

Examples

1
2
3
4
5
6
7
8
x <- data.frame(a=1:10)
x_str <- capture_expr({
  print(x)
})

x_str

cat(x_str)

dipsaus documentation built on Sept. 6, 2021, 5:08 p.m.