Learn R Programming

operator.tools (version 1.4.4)

is.operator: Utilities for operators

Description

These S4 Methods are utilies for working with operators. In R, operators are functions with special syntax.

Usage

is.operator(x, ...)

Arguments

x
object to be tested or coerced. Can be function or name.
...
additional arguments passed to operators.

Value

is.operator and can.operator return logical.as.operator returns the argument coerced to the concommitant R function.

Details

is.operator tests whether the object is one of the defined operators.

can.operator tests whether the object can be coerced to an operator.

as.operator coerced the object to an operator.

Optionally, you can specify one of the that it tests for a specific type of operator. See details, below.

An operator is R function with special syntax.

( See ??operator for examples of each. )

is.operator tests whether the argumenst is an operator.

as.operator coerces x to a operator, otherwise fails.

can.operator test whether the object can be coerced to an operator.

All functions can accepts a types argument which is passed to link{operators}. By specifying one or more types, these functions test using those types only.

New operators can be "registered" using setOperator.

See Also

operators, apropos, match.fun

Examples

Run this code
## Not run: 
#    is.operator( `+` )
#    is.operator( 'xyzzy' )
#    is.operator( `+`, types="arithmetic" )
#    is.operator( `+`, types="relational" )
# 
#    can.operator( `+` )
#    can.operator( 'xyzzy' )
#    can.operator( `+`, types="arithmetic" )
#    can.operator( `+`, types="relational" )
# 
#    as.operator( `+` )
#    as.operator( '+' )
#    as.operator( as.name('+') )
#  ## End(Not run)

Run the code above in your browser using DataLab