assert_is_call {assertive.types}R Documentation

Is the input a language object?

Description

Checks to see if the input is a language object.

Usage

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

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

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

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

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

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

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

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

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

is_symbol(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_call, is_expression, is_language, is_name and is_symbol wrap the corresponding is.* functions, providing more information on failure. The assert_* functions return nothing but throw an error if the corresponding is_* function returns FALSE.

Note

is_name and is_symbol are different names for the same function.

See Also

is.call, is.expression is.language and is.name.

Examples

a_call <- call("sin", "pi")
assert_is_call(a_call)
assert_is_language(a_call)
an_expression <- expression(sin(pi))
assert_is_expression(an_expression)
assert_is_language(an_expression)
a_name <- as.name("foo")
assert_is_name(a_name)
assert_is_language(a_name)
#These examples should fail.
assertive.base::dont_stop(assert_is_language(function(){}))

[Package assertive.types version 0.0-3 Index]