title: Grouped bar Graph using barplot
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/8148956/how-to-create-grouped-barplot-with-r">How to create grouped barplot with R</a>  </p>
  </blockquote>
  
  
  
  <pre><code>Species      Dbh   Height
  1       DF 383.7143 254.3036
  2       ES 403.3333 280.0000
  3        F 372.0000 270.0000
  4       FG 381.5000 275.0000
  5       GF 351.5838 242.6522
  6       HW 209.0000 198.0000
  7       LP 232.8571 218.3333
  8       PP 568.5000 330.0000
  9       SF 136.4286 154.1000
  10      WC 375.0757 234.8777
  11      WL 340.0588 252.5714
  12      WP 319.7273 251.3939
  </code></pre>
  
  <p>I want to turn the data above into a bar graph like this one. Species as bins and dbh and height as bars for each bin.</p>
  
  <p><img src="https://upload.wikimedia.org/wikipedia/en/timeline/e6dba37eba64dc9b0341bdffc002343d.png" alt="graph"></p>
  
  <p>I used the code: </p>
  
  <pre><code>aggregate(ufc[,4:5],ufc[3],mean,na.rm=TRUE)
  </code></pre>
  
  <p>to get the above data set</p>
  
  <p>I can only get one variable at a time using this code:</p>
  
  <pre><code>barplot(ufc.means$Height, col=rainbow(20), 
                              names.arg=(ufc.means$Species), las=2,main="Height")
  </code></pre>