Module: R::BinaryOperators
- Defined in:
- lib/R_interface/rbinary_operators.rb
Overview
Note that binary operators work on vectors and matrices as well as scalars.
Instance Method Summary collapse
-
#!=(other_object) ⇒ Object
(also: #ne)
--------------------------------------------------------------------------------------.
-
#%(other_object) ⇒ Object
(also: #mod)
--------------------------------------------------------------------------------------.
-
#*(other_object) ⇒ Object
--------------------------------------------------------------------------------------.
-
#**(other_object) ⇒ Object
--------------------------------------------------------------------------------------.
-
#+(other_object) ⇒ Object
-------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------.
-
#-(other_object) ⇒ Object
--------------------------------------------------------------------------------------.
-
#/(other_object) ⇒ Object
--------------------------------------------------------------------------------------.
-
#<(other_object) ⇒ Object
(also: #lt)
--------------------------------------------------------------------------------------.
-
#<=(other_object) ⇒ Object
(also: #le)
--------------------------------------------------------------------------------------.
-
#>(other_object) ⇒ Object
(also: #gt)
--------------------------------------------------------------------------------------.
-
#>=(other_object) ⇒ Object
(also: #ge)
--------------------------------------------------------------------------------------.
- #_(op, other_object) ⇒ Object
-
#eq(other_object) ⇒ Object
(also: #eql)
--------------------------------------------------------------------------------------.
-
#int_div(other_object) ⇒ Object
--------------------------------------------------------------------------------------.
-
#til(other_object) ⇒ Object
--------------------------------------------------------------------------------------.
Instance Method Details
#!=(other_object) ⇒ Object Also known as: ne
192 193 194 |
# File 'lib/R_interface/rbinary_operators.rb', line 192 def !=(other_object) exec_bin_oper("`!=`", other_object) end |
#%(other_object) ⇒ Object Also known as: mod
124 125 126 |
# File 'lib/R_interface/rbinary_operators.rb', line 124 def %(other_object) exec_bin_oper("`%%`", other_object) end |
#*(other_object) ⇒ Object
100 101 102 |
# File 'lib/R_interface/rbinary_operators.rb', line 100 def *(other_object) exec_bin_oper("`*`", other_object) end |
#**(other_object) ⇒ Object
116 117 118 |
# File 'lib/R_interface/rbinary_operators.rb', line 116 def **(other_object) exec_bin_oper("`^`", other_object) end |
#+(other_object) ⇒ Object
84 85 86 |
# File 'lib/R_interface/rbinary_operators.rb', line 84 def +(other_object) exec_bin_oper("`+`", other_object) end |
#-(other_object) ⇒ Object
92 93 94 |
# File 'lib/R_interface/rbinary_operators.rb', line 92 def -(other_object) exec_bin_oper("`-`", other_object) end |
#/(other_object) ⇒ Object
108 109 110 |
# File 'lib/R_interface/rbinary_operators.rb', line 108 def /(other_object) exec_bin_oper("`/`", other_object) end |
#<(other_object) ⇒ Object Also known as: lt
152 153 154 |
# File 'lib/R_interface/rbinary_operators.rb', line 152 def <(other_object) exec_bin_oper("`<`", other_object) end |
#<=(other_object) ⇒ Object Also known as: le
162 163 164 |
# File 'lib/R_interface/rbinary_operators.rb', line 162 def <=(other_object) exec_bin_oper("`<=`", other_object) end |
#>(other_object) ⇒ Object Also known as: gt
172 173 174 |
# File 'lib/R_interface/rbinary_operators.rb', line 172 def >(other_object) exec_bin_oper("`>`", other_object) end |
#>=(other_object) ⇒ Object Also known as: ge
182 183 184 |
# File 'lib/R_interface/rbinary_operators.rb', line 182 def >=(other_object) exec_bin_oper("`>=`", other_object) end |
#_(op, other_object) ⇒ Object
209 210 211 212 213 214 |
# File 'lib/R_interface/rbinary_operators.rb', line 209 def _(op, other_object) operator = op.to_s.gsub(/__/,".") # If it's a standard letter-based operator like 'in', wrap in % operator = "%#{operator}%" if operator =~ /^[a-zA-Z.]+$/ exec_bin_oper(operator, other_object) end |
#eq(other_object) ⇒ Object Also known as: eql
142 143 144 |
# File 'lib/R_interface/rbinary_operators.rb', line 142 def eq(other_object) exec_bin_oper("`==`", other_object) end |
#int_div(other_object) ⇒ Object
134 135 136 |
# File 'lib/R_interface/rbinary_operators.rb', line 134 def int_div(other_object) exec_bin_oper("`%/%`", other_object) end |
#til(other_object) ⇒ Object
202 203 204 205 206 207 |
# File 'lib/R_interface/rbinary_operators.rb', line 202 def til(other_object) return R::Support.exec_function_name("`~`", other_object) if ((self.is_a?(Symbol) && (self == :all)) || (self.is_a?(R::SymbolRef) && self.to_r_symbol == "all")) exec_bin_oper("`~`", other_object) end |