Create a Statement object.

Statement objects are used to create structured normal, warning or error messages.

Statement(general, specifics = NULL, env = NULL, decorate = NULL, ...)

Arguments

general

A single character which gives a general statement of a message.

specifics

Optional. A character vector which gives a list of details of a message. If specifics is a named vector, the names are used to create bullets. if the name is "x" or "i", the bullet will be colored and bold. Any item with no name will be named "x". Argument decorate is used to turn on/off this process of adding and decorating bullets. See "Examples" section.

env

Optional. An environment or named list which is used to evaluate the R code in the above arguments. See "Examples" section and glue::glue().

decorate

Optional. TRUE or FALSE which indicates if to decorate the bullets of specifics. The default value is TRUE.

...

Optional. Additional arguments which can be passed to rlang::abort() or related functions.

Value

A list of class Statement.

See also

trigger() for generating normal, warning and error messages.

vignette("erify") for a gentle introduction to this package.

Examples

# quick example general <- "I am the general statement of the message." specifics <- c("Detail 1.", i = "Detail 2.", `*` = "Detail 3") Statement(general, specifics)
#> I am the general statement of the message. #> #> Detail 1. #> Detail 2. #> * Detail 3
# do not decorate bullets Statement(general, specifics, decorate = FALSE)
#> I am the general statement of the message. #> #> Detail 1. #> iDetail 2. #> *Detail 3
# use R code in message Statement("`x` is `{x}`.", env = list(x = 1))
#> `x` is `1`.