title: The condition has length > 1 and only the first element will be used
body: <p>I have a dataframe, trip:</p>
  
  <pre><code>&gt; head(trip.mutations)
    Ref.y Variant.y
  1 T     C 
  2 G     C 
  3 A     C  
  4 T     C 
  5 C     A 
  6 G     A 
  </code></pre>
  
  <p>I want to add a third column, mutType, that follows these rules:</p>
  
  <pre><code>for (i in 1:nrow(trip)) {
     if(trip$Ref.y=='G' &amp; trip$Variant.y=='T'|trip$Ref.y=='C' &amp; trip$Variant.y=='A') {
        trip[i, 'mutType'] &lt;- "G:C to T:A"
     }
     else if(trip$Ref.y=='G' &amp; trip$Variant.y=='C'|trip$Ref.y=='C' &amp; trip$Variant.y=='G') {
        trip[i, 'mutType'] &lt;- "G:C to C:G"
     }
     else if(trip$Ref.y=='G' &amp; trip$Variant.y=='A'|trip$Ref.y=='C' &amp; trip$Variant.y=='T') {
        trip[i, 'mutType'] &lt;- "G:C to A:T"
     }
     else if(trip$Ref.y=='A' &amp; trip$Variant.y=='T'|trip$Ref.y=='T' &amp; trip$Variant.y=='A') {
        trip[i, 'mutType'] &lt;- "A:T to T:A"
     }
     else if(trip$Ref.y=='A' &amp; trip$Variant.y=='G'|trip$Ref.y=='T' &amp; trip$Variant.y=='C') {
        trip[i, 'mutType'] &lt;- "A:T to G:C"
     }
     else if(trip$Ref.y=='A' &amp; trip$Variant.y=='C'|trip$Ref.y=='T' &amp; trip$Variant.y=='G') {
        trip[i, 'mutType'] &lt;- "A:T to C:G"
     }
  }
  </code></pre>
  
  <p>but I get the error:</p>
  
  <pre><code>Warning messages:
  1: In if (trip$Ref.y == "G" &amp; trip$Variant.y == "T" | trip$Ref.y ==  ... :
    the condition has length &gt; 1 and only the first element will be used
  </code></pre>
  
  <p>I don't think my logical statements should be producing vectors, but maybe I'm missing something. trip$mutType <em>should</em> end up looking like this:</p>
  
  <pre><code>mutType
  A:T to G:C
  G:C to C:G
  A:T to C:G
  A:T to G:C
  G:C to T:A
  G:C to A:T
  </code></pre>
  
  <p>Can anyone spot what's wrong here? Do I need || instead of | perhaps?</p>