Learn R Programming

base (version 3.6.2)

is.function: Is an Object of Type (Primitive) Function?

Description

Checks whether its argument is a (primitive) function.

Usage

is.function(x)
is.primitive(x)

Arguments

x

an R object.

Value

TRUE if x is a (primitive) function, and FALSE otherwise.

Details

is.primitive(x) tests if x is a primitive function, i.e, if typeof(x) is either "builtin" or "special".

Examples

Run this code
# NOT RUN {
is.function(1) # FALSE
is.function (is.primitive) # TRUE: it is a function, but ..
is.primitive(is.primitive) # FALSE: it's not a primitive one, whereas
is.primitive(is.function)  # TRUE: that one *is*
# }

Run the code above in your browser using DataLab