assert_is_a_complex {assertive.types}R Documentation

Is the input complex?

Description

Checks to see if the input is complex.

Usage

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

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

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

is_complex(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_complex wraps is.complex, providing more information on failure. is_a_complex returns TRUE if the input is complex and scalar. The assert_* functions return nothing but throw an error if the corresponding is_* function returns FALSE.

See Also

is.complex and is_scalar.

Examples

assert_is_complex(c(1i, 2i))
assert_is_a_complex(1i)
assert_is_a_complex(1 + 0i)
assert_is_a_complex(NA_complex_)
#These examples should fail.
assertive.base::dont_stop(assert_is_complex(1:10))
assertive.base::dont_stop(assert_is_a_complex(c(1i, 2i)))
assertive.base::dont_stop(assert_is_a_complex(complex()))

[Package assertive.types version 0.0-3 Index]