Skip to contents

This function prints an object and captures the output as a string.

Usage

printCapture(obj)

Arguments

obj

The object to print and capture the output from.

Value

A string representing the printed output of the object.

Details

This is useful for printing data.frames to log files etc.

Examples

df <- data.frame(a = 1:3, b = letters[1:3])
printCapture(df)
#> [1] "  a b\n1 1 a\n2 2 b\n3 3 c"
# Returns a string representation of the data frame