Learn R Programming

assertive.base (version 0.0-9)

print_and_capture: Print a variable and capture the output

Description

Prints a variable and captures the output, collapsing the value to a single string.

Usage

print_and_capture(x, ...)

Arguments

x

A variable.

...

Arguments passed to print methods.

Value

A string.

See Also

print, capture.output

Examples

Run this code
# NOT RUN {
# This is useful for including data frames in warnings or errors
message("This is the sleep dataset:\n", print_and_capture(sleep))
# }

Run the code above in your browser using DataLab