Description Usage Arguments Details Value Functions
Use the stopWith
, warningWith
, and messageWith
functions
as replacements for the base stop
, warning
, and
message
functions when signaling with condition-based objects.
These re-base the object to the correct "condition" subclass based on how
they were signaled, adding either "error", "warning" and "message"
(respectively) just before "condition. They then matching this new object
with the matchin base R function. This allows handlers to catch
signaled objects based on how they were signaled, and to either group simple
message based signals in with object signals, or to differentiate them.
1 2 3 4 5 |
condition |
The condition object being signaled with. If the root class (last) is not "condition", the object is resignaled as is. |
Normally, when a signal is caught, the handler that process it is based on
the class of the signal object. R's familiar signaling functions
(stop
, warning
, and message
) create
objects that have different classes based on which was used. However, if you
pass one of these signaling function an object rather than a simple message,
it does not change the class. If you don't catch it, somehow R still
knows they are different signals and does the right thing. However if the
signal is caught in user code, this information is lost. A handler can not
then recall stop
, for instance, if it does not, after all, know
how to handle a signal (a common problem).
Nothing, called only for their signal generating and processing side effects.
stopWith
: Moves or adds class c("error",
"condition")
to the end of the class of a condition object.
The stop
function converts simple messages into objects of
class c("simpleError", "error", "condition")
; both can thus be
caught with an error=
handler, or they can be distinguished by the
"simpleError"
class that (should) only be on a simple message based
signal.
warningWith
: Moves or adds class c("warning",
"condition")
to the end of the class of the signal object.
The warning
function converts simple messages into objects of
class c("simpleWarning", "warning", "condition")
; both can thus be
caught with a warning=
handler, or they can be distinguished by the
"simpleWarning"
class that (should) only be on a simple message
based signal.
messageWith
: Moves or adds class c("message",
"condition")
to the end of the class of the signal object.
The message
function converts simple messages into objects of
class c("simpleMessage", "message", "condition")
; both can thus be
caught with a message=
handler, or they can be distinguished by the
"simpleMessage"
class that (should) only be on a simple message
based signal.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.