operator.type: Return the type for an operator.

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

View source: R/operator.type.R

Description

Given an operator or its name/symbol, return the type of operator.

Usage

1

Arguments

op

An operator either as a name/symbol or function.

Details

The operator is first checked against all operators that have been registered with the setOperator command. If there is a match, its type is returned. If no matching operator is found, op is matched against unregistered operators that have been defined with the %any%-syntax. If a match is found, UNREGISTERED is returned.

The list of operators are maintained in .Options\$operators and be altered suing the setOperator command.

Value

A character value.

For registered operators, the registered type is returned. For Base R operators, the types come from Syntax.

For operators defined with the %any%-syntax but, not registered using setOperator, "UNREGISTERED" is returned.

NULL is returned otherwise.

Author(s)

Christopher Brown

See Also

operators, setOperator. Syntax

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
 ## Not run: 
  operator.type( `+` )
  operator.type( `<=` )
  
  e <- quote( A +B )
  operator.type( e[[1]] )

  operator.type( as.name('+') )
 
## End(Not run)
 

operator.tools documentation built on May 1, 2019, 8 p.m.