Learn R Programming

assertive (version 0.1-7)

assert_is_call: Is the input a language object?

Description

Checks to see if the input is a language object.

Usage

assert_is_call(x)

  assert_is_expression(x)

  assert_is_language(x)

  assert_is_name(x)

  assert_is_symbol(x)

  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.
.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.

See Also

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

Examples

Run this code
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.
assert_is_language(function(){})

Run the code above in your browser using DataLab