title: Count elements from a vector with also zero frequencies in r
body: <p>I have a vector with characters like this:</p>
  
  <pre><code>v1 &lt;- c("A", "B", "C", "D", "E")
  </code></pre>
  
  <p>and I want to count the frequencies of every character in another vector i.e.:</p>
  
  <pre><code>v2 &lt;- c("B", "B", "C", "D", "C")
  </code></pre>
  
  <p>the output should be like this:</p>
  
  <pre><code>A B C D E
  0 2 2 1 0
  </code></pre>
  
  <p>I've tried with <code>table()</code>, <code>merge()</code>, and using <code>%in%</code>, but I can't get an output with also the zero frequencies of the characters which are not in the vector that I'm examining.</p>