Learn R Programming

W4MRUtils (version 1.2.1)

printfp: printfp - to paste, format and print a string

Description

printfp calls paste and sprintf of its parameters to build the error message and prints with the given message

Usage

printfp(x, ...)

Value

NULL

Arguments

x

a list of format string to concatenate before using sprintf on it.

...

Arguments passed on to base::paste

sep

a character string to separate the terms. Not NA_character_.

collapse

an optional character string to separate the results. Not NA_character_. When collapse is a string, the result is always a string (character of length 1).

recycle0

logical indicating if zero-length character arguments should result in the zero-length character(0). Note that when collapse is a string, recycle0 does not recycle to zero-length, but to "".

Author

L.Pavot

Examples

Run this code

file <- "/tmp/test"
printfp(
  list(
    "Very log error message that needs to be cut on multiple lines,",
    "and paste back together, but there are formatings like",
    "%%s for example, that provides a placeholder for parameters.",
    "Here %%s value is %s."
  ), file
)

Run the code above in your browser using DataLab