Learn R Programming

chk (version 0.4.0)

err: Stop, Warning and Message Messages

Description

The functions call message_chk() to process the message and then rlang::abort(), rlang::warn() and rlang::inform(), respectively.

Usage

err(..., n = NULL, tidy = TRUE, .subclass = NULL)

wrn(..., n = NULL, tidy = TRUE, .subclass = NULL)

msg(..., n = NULL, tidy = TRUE, .subclass = NULL)

Arguments

...

zero or more objects which can be coerced to character (and which are pasted together with no separator) or a single condition object.

n

The value of n for converting sprintf-like types.

tidy

A flag specifying whether capitalize the first character and add a missing period.

.subclass

This argument was renamed to class in rlang 0.4.2. It will be deprecated in the next major version. This is for consistency with our conventions for class constructors documented in https://adv-r.hadley.nz/s3.html#s3-subclassing.

Functions

  • err: Error

  • wrn: Warning

  • msg: Message

Details

The user can set the subclass.

Examples

Run this code
# NOT RUN {
# err
try(err("there %r %n problem value%s", n = 2))

# wrn
wrn("there %r %n problem value%s", n = 2)

# msg
msg("there %r %n problem value%s", n = 2)
# }

Run the code above in your browser using DataLab