operator.tools: Utilities for Working with R's Operators

> library(operator.tools)

バージョン: 1.4.4


関数名 概略
.initOps Initialize operators
can.operator can.operator
fun2name Convert between a function and its name and vice versa.
inverse Invert an R operator
is.operator Utilities for operators
notin NOT IN
operator.tools-package Utilities for working with R operators
operator.type Return the type for an operator.
operators Return the names of defined operators.
rel.type Get the relational type of a relational operator.
removeOperator Unregister a an operator.
setOperator Registers an operator for use with operator.tools package.

is.operator

> is.operator(`+`)
[1] TRUE
> is.operator(`+`, types = "arithmetic")
[1] TRUE

notin

> c(1, 3, 10) %!in% 1:5
[1] FALSE FALSE  TRUE

operators

利用可能な演算子を出力する

Arguments

  • types... arithmetic, relational, logical, tilde, assignment, help, user
> operators()
 [1] "::"    ":::"   "@"     "$"     "["     "[["    ":"     "+"    
 [9] "-"     "*"     "/"     "^"     "%%"    "%/%"   "<"     "<="   
[17] ">"     ">="    "=="    "!="    "%in%"  "%!in%" "!"     "&"    
[25] "&&"    "|"     "||"    "~"     "<-"    "<<-"   "="     "?"    
[33] "%*%"   "%x%"   "%o%"
> operators(types = "tilde")
[1] "~"

operator.type

> operator.type(`<=`)
[1] "relational"