Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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.

Details

The user can set the subclass.

Functions

  • err: Error

  • wrn: Warning

  • msg: Message

Examples

# 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)

chk

Check User-Supplied Function Arguments

v0.5.1
MIT + file LICENSE
Authors
Joe Thorley [aut, cre] (<https://orcid.org/0000-0002-7683-4592>), Kirill Müller [aut] (<https://orcid.org/0000-0002-1416-3412>), Ayla Pearson [ctb] (<https://orcid.org/0000-0001-7388-1222>), Poisson Consulting [cph, fnd]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.