title: Sort a matrix based on the number of repeating elements in a particular column in R
body: <p>I have a matrix with only column labels, and I want to sort by column A, where repeating elements are ranked before non-repeating.  So because 7 appears four times in column A then is is moved to be in front of the rows with 2 in column A.  I hope this makes sense.</p>
  
  <pre><code>    A   B   C
      1   11  14
      2   2   2
      2   5   12
      2   13  2
      3   16  19
      3   10  0
      4   20  17
      5   5   16
      7   14  18
      7   8   10
      7   10  17
      7   7   0
  </code></pre>
  
  <p>Now, what I want it to look like is the following.</p>
  
  <pre><code>    A   B   C
      7   14  18
      7   8   10
      7   10  17
      7   7   0
      2   2   2
      2   5   12
      2   13  2
      3   16  19
      3   10  0
      1   11  14
      4   20  17
      5   5   16
  </code></pre>
  
  <p>Thank you so much for your assistance.</p>