title: R - retrieve row numbers after sorting
body: <p>I was wondering how I could retrieve the row numbers after having sorted my data. </p>
  
  <p>Let us imagine my vector is this one: </p>
  
  <pre><code>vec = c("GET FRESH", "EASTENDERS", "WORLD CUP", "SPORT", "DYNASTY" )
  </code></pre>
  
  <p>and then I sort </p>
  
  <pre><code>sort(vec)
  [1] "DYNASTY"    "EASTENDERS" "GET FRESH"  "SPORT"      "WORLD CUP" 
  </code></pre>
  
  <p>How could I get the row numbers of each case? </p>
  
  <pre><code>     vec          rownumber
  [1,] "DYNASTY"    "5"      
  [2,] "EASTENDERS" "2"      
  [3,] "GET FRESH"  "1"      
  [4,] "SPORT"      "4"      
  [5,] "WORLD CUP"  "3" 
  </code></pre>