Captures the output of print() as a character string.
Examples
x = data.frame(a = 1:2, b = 3:4)
str(printToChar(x))
#> chr " a b\n1 1 3\n2 2 4"
Captures the output of print() as a character string.
x = data.frame(a = 1:2, b = 3:4)
str(printToChar(x))
#> chr " a b\n1 1 3\n2 2 4"