Learn R Programming

assertive (version 0.2-6)

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.

Value

  • A string.

See Also

print, capture.output

Examples

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

Run the code above in your browser using DataLab