print_message: Print a message

Description Usage Arguments Details Value Note Author(s)

View source: R/fct_print_message.R

Description

A common interface for printing messages of several types.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
print_message(
  ...,
  type,
  sep = "",
  date = FALSE,
  date_format = "",
  width = 0.9 * getOption("width"),
  indent = TRUE,
  exdent = TRUE,
  prefix = "",
  initial = prefix
)

Arguments

...

'R' objects which are concatenated.

type

Type of the output .Accepted values: - 'message' for a diagnostic message; - 'string' for a character output; - 'cat' for the output of 'cat()' function; - 'error' and 'warning' for an error or warning message.

Intentionally, no default value is defined.

sep

(optional) character used to separate input values (default is nothing).

date

Logical value: set 'TRUE' to place the date before the message and after the prefix (this is useful for logs or time consuming operations); default is FALSE.

date_format

Format of the date (see 'strftime()') for the definition of the format). The default format is ''%Y-%m-%d %H:%M:%S''.

width

Positive integer: target column for wrapping lines in the output (set to 'Inf' for no wrapping).

indent

Non-negative integer: indentation of the first line in a paragraph It can be also a logical: in this case, if TRUE (default) the value is optimised in order to align first line with the followings.

exdent

Non-negative integer: indentation of subsequent lines in paragraphs. It can be also a logical: in this case, if TRUE (default) the value is optimised in order to align lines with the first line.

prefix

Character: prefix for each line except the first.

initial

Character: prefix for the first line.

Details

Several functions print messages in different formats (message, error, warning, cat, R output) and with different syntaxes (concatenating parameters or accepting a single argument, appending a new line, etc.). This accessory function provides a common interface for different types: several arguments are accepted and concatenated with the 'sep' argument; the format is defined with the 'format' argument; a date is optionally placed before the message.

Value

Message (in the defined format).

Note

License: GPL 3.0

Author(s)

Luigi Ranghetti, phD (2020) luigi@ranghetti.info


pobsteta/shinyCNES documentation built on April 28, 2021, 9:43 a.m.