title: Include zero frequencies in frequency table for Likert data
body: <p>I have a dataset with responses to a Likert item on a 9pt scale. I would like to create a frequency table (and barplot) of the data but some values on the scale never occur in my dataset, so <code>table()</code> removes that value from the frequency table. I would like it instead to present the value with a frequency of <code>0</code>. That is, given the following dataset</p>
  
  <pre><code># Assume a 5pt Likert scale for ease of example
  data &lt;- c(1, 1, 2, 1, 4, 4, 5)
  </code></pre>
  
  <p>I would like to get the following frequency table without having to manually insert a column named <code>3</code> with the value <code>0</code>.</p>
  
  <pre><code>1 2 3 4 5 
  3 1 0 2 1
  </code></pre>
  
  <p>I'm new to <code>R</code>, so maybe I've overlooked something basic, but I haven't come across a function or option that gives the desired result.</p>