title: dplyr reordering rows by string
body: <p>I have the following data:</p>
  
  <pre><code>library(tidyverse)
  
  
  d1 &lt;- data_frame(Nat = c("UK", "UK", "UK", "NONUK", "NONUK", "NONUK"),
   Type = c("a", "b", "c", "a", "b", "c"))
  </code></pre>
  
  <p>I would like to rearrange the rows so the dataframe looks like this:</p>
  
  <pre><code>d2 &lt;- data_frame(
   Nat = c("UK", "UK", "UK", "NONUK", "NONUK", "NONUK"),
   Type = c("b", "c", "a", "b", "c", "a"))
  </code></pre>
  
  <p>So the UK and Non UK grouping remains, but the 'Type' rows have shifted. This questions is quite like this one: <a href="https://stackoverflow.com/questions/24035379/reorder-rows-conditional-on-a-string-variable">Reorder rows conditional on a string variable</a></p>
  
  <p>However the answer above is dependent on the rows you are reordering being in alphabetical order (excluding London). Is there a way to reorder a string value more specifically where you select order of the rows yourself, rather than relying on it being alphabetical? Is there a way to do this using dplyr?</p>
  
  <p>Thanks!</p>