title: Grouped data from CSV and create chart with R
body: <p>Well, with R. 
  I have this CSV:</p>
  
  <pre><code>"ID","Kind","Variety","Category","Kgrs","Kgrs_m2"
  "120-1","HOLLAND","MULHACEN","12G",1206,0.25
  "120-1","HOLLAND","MULHACEN","12M",4708,0.99
  "120-2","HOLLAND","MULHACEN","12G",2190,0.46
  "120-2","HOLLAND","MULHACEN","12P",5746,1.20
  "120-3","CHERRY","MINISTAR","A",9165,3.05
  "120-3","CHERRY","MINISTAR","B",50,0.017
  "120-3","CHERRY","MINISTAR","DES",1182,0.39
  "120-3","HOLLAND","MULHACEN","12G",372,0.12
  "120-7","CHERRY","MINISTAR","A",6584,3.05
  "120-7","CHERRY","MINISTAR","B",321,1.05
  </code></pre>
  
  <p>I want to do something like this graph, with R:</p>
  
  <p><img src="https://i.stack.imgur.com/6DVdm.png" alt="enter image description here"></p>
  
  <p>I read the CSV, but I don't know what I must do to group data from the CSV and put this data into the barplot.</p>
  
  <p>Also I need add Variety to each group of ID.</p>
  
  <p>This is my code:</p>
  
  <pre><code>path &lt;- "./"
  
  cosechas &lt;- read.csv(paste(path, "test.csv",  sep="/"),header=T)
  
  cosechas$Kgms &lt;-  as.numeric(cosechas$Kgms)
  
  
  
  fi &lt;- c(cosechas$Kgms)
  names(fi) &lt;- levels(cosechas$Category)
  
  
  png(paste(path, "cosechas.png", sep="/"))
  
  barplot(fi, ylab="Kg", xlab="Categoria")
  dev.off()
  </code></pre>
  
  <p>Thanks in advance.</p>