title: Sort dataframe group according to a target vector in R
body: <p>I have a dataframe such as shown below (original data is really big). I want to sort them based on the group of target vector and get the result.</p>
  
  <p>dataframe</p>
  
  <pre><code>sample     group    
  A           AA 
  B           CC
  C           CC
  D           BB
  E           AA
  F           AA
  
  target.vector &lt;- c("AA", "BB", "CC")
  </code></pre>
  
  <p>result</p>
  
  <pre><code> sample     group    
      A           AA 
      E           AA
      F           AA
      D           BB
      B           CC
      C           CC
  </code></pre>