assertive.types (version 0.0-1)

assert_is_a_raw: Is the input raw?

Description

Checks to see if the input is raw.

Usage

assert_is_a_raw(x, severity = getOption("assertive.severity", "stop"))

assert_is_raw(x, severity = getOption("assertive.severity", "stop"))

is_a_raw(x, .xname = get_name_in_parent(x))

is_raw(x, .xname = get_name_in_parent(x))

Arguments

x
Input to check.
severity
How severe should the consequences of the assertion be? Either "stop", "warning", "message", or "none".
.xname
Not intended to be used directly.

Value

  • is_raw wraps is.raw, providing more information on failure. is_a_raw returns TRUE if the input is raw and scalar. The assert_* functions return nothing but throws an error if the corresponding is_* function returns FALSE.

See Also

is.raw and is_scalar.

Examples

Run this code
assert_is_raw(as.raw(1:10))
assert_is_a_raw(as.raw(255))
#These examples should fail.
assertive.base::dont_stop(assert_is_raw(c(TRUE, FALSE)))
assertive.base::dont_stop(assert_is_a_raw(as.raw(1:10)))
assertive.base::dont_stop(assert_is_a_raw(raw()))

Run the code above in your browser using DataLab