is_language: Is the input a language object?

Description Usage Arguments Value Note See Also Examples

View source: R/is-type-base.R

Description

Checks to see if the input is a language object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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(){}))

assertive.types documentation built on May 1, 2019, 10:31 p.m.