title: dply: order columns alphabetically in R
body: <p>If I have a large DF (hundreds and hundreds) columns with different  col_names randomly distributed alphabetically:</p>
  
  <pre><code>df.x &lt;- data.frame(2:11, 1:10, rnorm(10))
  colnames(df.x) &lt;- c("ID", "string", "delta")
  </code></pre>
  
  <p>How would I order all of the data (vertically) by col_name alphabetically?</p>
  
  <p>Essentially, I have hundreds of CSV(sep="|") text files that I need to read their columns into a single df, order those columns alphabetically and then use some other dplyf functions to get a final result. I have all of this figured out except how to order the columns alphabetically. I do not want to sort the columns (up and down) by alphabet, rather, the actual vertical orientation of the col_names and their corresponding data. Analogous to cutting and pasting entire columns of data in Excel.</p>
  
  <p>For example I reviewed this approach but this is the "sort" the rows alphabetically bit, which is not what I'm looking to do.</p>
  
  <p><a href="https://stackoverflow.com/questions/1296646/how-to-sort-a-dataframe-by-columns-in-r?rq=1">How to sort a dataframe by column(s)?</a></p>
  
  <p>Thanks!</p>