Learn R Programming

assertive (version 0.2-1)

assert_is_array: Is the input an array or matrix?

Description

Checks to see if the input is an array or matrix.

Usage

assert_is_array(x)

assert_is_matrix(x)

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

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

Arguments

x
Input to check.
.xname
Not intended to be used directly.

Value

  • is_array and is_matrix wrap is.array, and is.matrix respectively, providing more information on failure. The assert_* functions return nothing but throw an error if the corresponding is_* function returns FALSE.

Examples

Run this code
assert_is_array(array())
assert_is_array(matrix())
assert_is_matrix(matrix())
#These examples should fail.
dont_stop(assert_is_matrix(array()))

Run the code above in your browser using DataLab