is.operator: Utilities for operators

Description Usage Arguments Details Value Author(s) See Also Examples

Description

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

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.

Usage

1
2
3

Arguments

x

object to be tested or coerced.

...

additional arguments passed to operators.

Details

An operator is R function with special syntax. They can can be one the core R operators: relational, arithmetic, tilde, single- double- or triple colon, logical, or assignment. Or it can be a user-defined operators.

( 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 or coerce using those types only.

Value

is.operator and can.operator return logical.

as.operator returns the argument coerced to the concommitant R function.

Author(s)

Christopher Brown

See Also

operators, apropos, S4groupGeneric

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
 

  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('+') )  

operators documentation built on May 2, 2019, 6:48 p.m.