title: R move column to last using dplyr
body: <p>For a data.frame with <strong>n</strong> columns, I would like to be able to move a column from any of <strong>1-(n-1)</strong> positions, to be the nth column (i.e. a non-last column to be the last column). I would also like to do it using <code>dplyr</code>. I would like to do so without simply typing out the names of all the columns. </p>
  
  <p>For example:</p>
  
  <pre><code>data&lt;-data.frame(a=1:5, b=6:10, c=11:15)
  </code></pre>
  
  <p>This works, but isn't the <code>dplyr</code> way:  </p>
  
  <pre><code>data[,c(colnames(data)[colnames(data)!='b'],'b')]
  </code></pre>
  
  <p>This is the <code>dplyr</code> way to make column <code>b</code> first:  </p>
  
  <pre><code>data%&gt;%select(b, everything())
  </code></pre>
  
  <p>But this doesn't work to make column <code>b</code> last:  </p>
  
  <pre><code>data%&gt;%select(everything(), b)
  </code></pre>
  
  <p>This works, but requires me to type out all the columns:  </p>
  
  <pre><code>data%&gt;%select(a,c,b)
  </code></pre>
  
  <p>So is there an elegant dplyr way to do this?</p>
  
  <p>Related questions:  </p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/22286419/move-column-to-first-in-a-data-frame">move column to first in a data frame</a>  </li>
  <li><a href="https://stackoverflow.com/questions/5620885/how-does-one-reorder-columns-in-a-data-frame">How does one reorder columns in a data frame?</a></li>
  </ul>