setOperator: Registers an operator for use with operator.tools package.

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

View source: R/setOperator.R

Description

setOperator registers a user-defined operator as a given type. Subsequently, this operator can be treated as a member of a class of operators.

Usage

1
2
3

Arguments

name

A character vector containing the names of one or more functions which will be registered.

type

The type of operator. See Details.

...

Attributes for the operator(s).

Details

setOperators scans defined functions looking for any that have been defined by the user using the special any syntax. If found, these are registered with setOperator and given the default type='user'.

setOperator registers a single operator similar to the way that setMethod registers a method. The definition for these operators are defined by .Options$operators.

setOperators scans the environments for user-defined operators. If found and not already registered, these are registered by setOperator. Registered operators are much more efficient than unregisted ones, so it is often advantageous to register the operators. When ... is supplied, these attributes are set for all unregistered operators.

Operators are allowed to have attributes. The one required attribute is type, which is just a character value that serves to classification the operator. On package load, All operators from base R are assigned a core type as specified in Syntax. These are: namespace, component, indexing, sequence, arithmetic, arithmetic, relational, logical, tilde, assignment, help.

Users may use one of these types or assign a type of their own choosing. The type is largely unrestricted, but cannot be one of the reserved operator groupings: ALL, REG(ISTERED), UNREG(ISTERED), SPECIAL or user. These have special meaning as described in operators. Users are encouraaged to make their own types in lower case.

Value

None. This function exists for assigning a operator to options('operators').

Author(s)

Christopher Brown

See Also

operators, Syntax

Examples

1
2
3
4
5
  ## Not run: 
    setOperator( '%!in%', 'relational' )
    operators( type='relational' )
  
## End(Not run)

decisionpatterns/operator.tools documentation built on Sept. 21, 2017, 10:30 p.m.