title: Sort columns numerically in R
body: <p>I have data that looks like the following, except the numbers are out of order:</p>
  
  <pre><code>dat&lt;-
  paste("Experience",1:20,sep="_")
  </code></pre>
  
  <p>Basically, I am trying to sort the columns in numerical order based on the ending number to order them as the code above produces. However, when I <code>sort</code> the values, it sorts based on the first digit as such:</p>
  
  <pre><code>"Experience_1"  "Experience_10"  "Experience_11" "Experience_12" 
  "Experience_13" "Experience_14"  "Experience_15" "Experience_16" 
  "Experience_17" "Experience_18" "Experience_19" "Experience_2" 
  "Experience_20" "Experience_3"  "Experience_4"  "Experience_5" 
  "Experience_6"  "Experience_7" "Experience_8"  "Experience_9"
  </code></pre>
  
  <p>Thoughts?</p>