Learn R Programming

mlr3misc (version 0.15.1)

printf: Functions for Formatted Output and Conditions

Description

catf(), messagef(), warningf() and stopf() are wrappers around base::cat(), base::message(), base::warning() and base::stop(), respectively. The call is not included for warnings and errors.

Usage

catf(msg, ..., file = "", wrap = FALSE)

messagef(msg, ..., wrap = FALSE)

warningf(msg, ..., wrap = FALSE)

stopf(msg, ..., wrap = FALSE)

Arguments

msg

(character(1))
Format string passed to base::sprintf().

...

(any)
Arguments passed down to base::sprintf().

file

(character(1))
Passed to base::cat().

wrap

(integer(1) | logical(1))
If set to a positive integer, base::strwrap() is used to wrap the string to the provided width. If set to TRUE, the width defaults to 0.9 * getOption("width"). If set to FALSE, wrapping is disabled (default). If wrapping is enabled, all whitespace characters ([[:space:]]) are converted to spaces, and consecutive spaces are converted to a single space.

Examples

Run this code
messagef("
  This is a rather long %s
  on multiple lines
  which will get wrapped.
", "string", wrap = 15)

Run the code above in your browser using DataLab