Learn R Programming

assertive (version 0.2-6)

assert_is_function: Is the input a function?

Description

Checks to see if the input is a function.

Usage

assert_is_function(x)

assert_is_primitive(x)

assert_is_stepfun(x)

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

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

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

Arguments

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

Value

  • is_function, is_primitive and is_stepfun wrap is.function, is.primitive and is.stepfun repsectively, providing more information on failure. The assert_* functions return nothing but throw an error if the corresponding is_* function returns FALSE.

See Also

is.function.

Examples

Run this code
assert_is_function(sqrt)
assert_is_function(function(){})

Run the code above in your browser using DataLab