Frequency density barplot of categorical variable
<p>I'd like to plot a barplot of frequency density of the following ordered categorical data:</p>
<pre><code>summary(ACC[EA$TYPE==&quot;A&quot;])
NG SG LG MG HG 
 2 25 36 17  0 
</code></pre>
<p>If I plot:</p>
<pre><code>plot(ACC[EA$TYPE==&quot;A&quot;])
</code></pre>
<p>I get:</p>
<p><a href="https://i.stack.imgur.com/hVU75.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hVU75.png" alt="enter image description here" /></a></p>
<p>But I'd like to divide all the values by the total to get a frequency density:
Ie.
<code>plot(ACC[EA$TYPE==&quot;A&quot;]/sum(as.numeric(ACC[EA$TYPE==&quot;A&quot;])))</code> but that doesn't work. Any tips?</p>
<p>Cheers,</p>