Description Usage Arguments Value Examples
Checks to see if the input is a message, warning or error.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | assert_is_try_error(x, severity = getOption("assertive.severity", "stop"))
assert_is_simple_error(x, severity = getOption("assertive.severity", "stop"))
assert_is_error(x, severity = getOption("assertive.severity", "stop"))
assert_is_simple_warning(x, severity = getOption("assertive.severity",
"stop"))
assert_is_warning(x, severity = getOption("assertive.severity", "stop"))
assert_is_simple_message(x, severity = getOption("assertive.severity",
"stop"))
assert_is_message(x, severity = getOption("assertive.severity", "stop"))
assert_is_condition(x, severity = getOption("assertive.severity", "stop"))
is_try_error(x, .xname = get_name_in_parent(x))
is_simple_error(x, .xname = get_name_in_parent(x))
is_error(x, .xname = get_name_in_parent(x))
is_simple_warning(x, .xname = get_name_in_parent(x))
is_warning(x, .xname = get_name_in_parent(x))
is_simple_message(x, .xname = get_name_in_parent(x))
is_message(x, .xname = get_name_in_parent(x))
is_condition(x, .xname = get_name_in_parent(x))
|
x |
Input to check. |
severity |
How severe should the consequences of the assertion be?
Either |
.xname |
Not intended to be used directly. |
The is_*
functions return TRUE
or FALSE
depending upon whether or not the input is a datetime object.
The assert_*
functions return nothing but throw an error if the
corresponding is_*
function returns FALSE
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # stop returns simpleErrors, unless wrapped in a call to try
simple_err <- tryCatch(stop("!!!"), error = function(e) e)
is_simple_error(simple_err)
try_err <- try(stop("!!!"))
is_try_error(try_err)
# is_error checks for both error types
is_error(try_err)
is_error(simple_err)
# warning returns simpleWarnings
simple_warn <- tryCatch(warning("!!!"), warning = function(w) w)
is_simple_warning(simple_warn)
is_warning(simple_warn)
# message returns simpleMessages
simple_msg <- tryCatch(message("!!!"), message = function(m) m)
is_simple_message(simple_msg)
is_message(simple_msg)
# These examples should fail.
assertive.base::dont_stop(assert_is_simple_error(try_err))
assertive.base::dont_stop(assert_is_try_error(simple_err))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.