Learn R Programming

insight (version 0.17.0)

format_message: Format messages and warnings

Description

Inserts line breaks into a longer message or warning string. Line length is adjusted to maximum length of the console, if the width can be accessed. By default, new lines are indented by two whitespace.

Usage

format_message(string, ..., line_length = options()$width)

Arguments

string

A string.

...

Further strings that will be concatenated as indented new lines.

line_length

Numeric, the maximum length of a line.

Value

A formatted string.

Examples

Run this code
# NOT RUN {
msg <- format_message("Much too long string for just one line, I guess!",
  line_length = 15
)
message(msg)

msg <- format_message("Much too long string for just one line, I guess!",
  "First new line",
  "Second new line",
  "(both indented)",
  line_length = 30
)
message(msg)
# }

Run the code above in your browser using DataLab