title: Lowering infix operator precedence in R?
body: <p>I'm trying to make an 'implies' operator for logical variables in R to make propositional calculus easier. However it doesn't seem to be playing nice with the negation operator. As the last 4 lines here indicate, I have to wrap negated variables in parentheses to get the implication operator to work correctly. </p>
  
  <p>I suspect that operator precedence is the issue but I'm not sure. And from what I read there isn't a way to change an infix operator's precedence. Is there a way I could redefine <code>implies()</code> so that the parentheses in <code>(!q) %-&gt;% (!p)</code> wouldn't be necessary?</p>
  
  <pre><code>&gt; implies &lt;- function(p, q) !p | q
  &gt; "%-&gt;%" &lt;- implies
  &gt; 
  &gt; p &lt;- c(TRUE, TRUE, FALSE, FALSE)
  &gt; q &lt;- c(TRUE, FALSE, TRUE, FALSE)
  &gt; p %-&gt;% q
  [1]  TRUE FALSE  TRUE  TRUE
  &gt; !q %-&gt;% !p
  [1]  TRUE FALSE FALSE FALSE
  &gt; (!q) %-&gt;% !p
  [1]  TRUE FALSE  TRUE  TRUE
  </code></pre>