title: Count number of occurences for each unique value
body: <p>Let's say I have:</p>
  
  <pre><code>v = rep(c(1,2, 2, 2), 25)
  </code></pre>
  
  <p>Now, I want to count the number of times each unique value appears. <code>unique(v)</code> returns what the unique values are, but not how many they are. </p>
  
  <pre><code>&gt; unique(v)
  [1] 1 2
  </code></pre>
  
  <p>I want something that gives me </p>
  
  <pre><code>length(v[v==1])
  [1] 25
  length(v[v==2])
  [1] 75
  </code></pre>
  
  <p>but as a more general one-liner :) Something close (but not quite) like this:</p>
  
  <pre><code>#&lt;doesn't work right&gt; length(v[v==unique(v)])
  </code></pre>