title: Group by amount of location
body: <p>I would like to find out how orders are distributed according to the number of localities. So, how many order numbers are going to one locality, how many two and so on.</p>
  
  <p>Example:</p>
  
  <pre><code>Nr &lt;- c("x1", "x2", "x2", "x2", "x3", "x4", "x4", "x4", "x5", "x5", "x5", 
  "x6")
  location &lt;- c("a", "b", "a", "b", "c", "a", "a", "a", "a", "b", "c", "d")
  (test &lt;- data.frame(cbind(Nr, location)))
  
  &gt; test
  Nr location
  1  x1        a
  2  x2        b
  3  x2        a
  4  x2        b
  5  x3        c
  6  x4        a
  7  x4        a
  8  x4        a
  9  x5        a
  10 x5        b
  11 x5        c
  12 x6        d
  </code></pre>
  
  <p>Is my dataset. </p>
  
  <p>With:</p>
  
  <pre><code>test %&gt;% group_by(Nr, location) %&gt;% summarise(quantity = n()) -&gt; test2
  </code></pre>
  
  <p>I get my table sorted by order number and location including the corresponding quantity:</p>
  
  <pre><code># A tibble: 9 x 3
  # Groups:   Nr [6]
  Nr    location quantity
  &lt;fct&gt; &lt;fct&gt;     &lt;int&gt;
  1 x1    a             1
  2 x2    a             1
  3 x2    b             2
  4 x3    c             1
  5 x4    a             3
  6 x5    a             1
  7 x5    b             1
  8 x5    c             1
  9 x6    d             1
  </code></pre>
  
  <p>now I want to know how often a order number visits only one location how often two and so on.</p>
  
  <p>The result should be a table like the next one:</p>
  
  <pre><code>Table
  n_Order     NumberOfObservations
  1           6
  2           3
  3           3
  ....        ....
  </code></pre>
  
  <p>Unfortunately, I don't know how to do this. Can someone help me?</p>