title: Barplot one column based on another column from the same dataframe
body: <p>I'm trying to create a barplot but confused...I'm very new to R</p>
  <p>Here is how the dataframe looks like</p>
  <p><a href="https://i.stack.imgur.com/kBq0t.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kBq0t.png" alt="click me" /></a></p>
  <p>I want to create a barplot to show age distribution but based on the exposed column, the exposed column have 2 groups, one is call the control group as you can see in the picture, the other one is called the test group.</p>
  <p>so far I only know how to create a barplot based on one column.</p>
  <pre><code>barplot(table(df$income),  ylab=&quot;amount of income blocks&quot;,main=&quot;Barplot of Income&quot;,col = &quot;firebrick&quot;, las=2)
  </code></pre>
  <p>As requested, this is the screenshot of what dput(df$exposed) looks like
  <a href="https://i.stack.imgur.com/BiEHR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BiEHR.png" alt="click me" /></a></p>
  <p>and this is what dput(df$age) looks like
  <a href="https://i.stack.imgur.com/YPLYp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YPLYp.png" alt="click me" /></a></p>
  <p>what I want the barplot to look like is to have 2 barplots, the first barplot shows the age distribution based on the number of test group, the second barplot shows the age distribution based on the number of control group.</p>
  <p>Or, if you can, it would be better to show just 1 barplot with different color that 1 color represent test group and 1 color represent control group with all the age distribution.</p>