title: How to swap values in two column simultaneously with dplyr
body: <p>I have the following data frame:</p>
  
  <pre><code>df &lt;- structure(list(sqn = c("FOO", "BAR"), start = c(1, 99), end = c(531, 
  1), strand = c("+", "-")), row.names = c(NA, -2L), class = c("tbl_df", 
  "tbl", "data.frame"))
  </code></pre>
  
  <p>That looks like:</p>
  
  <pre><code># A tibble: 2 x 4
    sqn   start   end strand
    &lt;chr&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;chr&gt; 
  1 FOO       1   531 +     
  2 BAR      99     1 -     
  </code></pre>
  
  <p>What I want to do is to swap values in <code>start</code> and <code>end</code> column 
  if <code>strand == "-"</code>. The desired result is this:</p>
  
  <pre><code># A tibble: 2 x 4
    sqn   start   end strand
    &lt;chr&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;chr&gt; 
  1 FOO       1   531 +     
  2 BAR       1    99 -   
  </code></pre>
  
  <p>How can I achieve that?</p>