title: barplot with ggplot2 for gene expression
body: <p>I am new to ggplot2 and I am having difficulties to make a barplot for  each gene by 2 factors.</p>
  
  <p>I would like to plot each gene individually by 2 factors: "cell_type" and "age". </p>
  
  <p>The x-axis would represent "cell type" (6) categories  and inside each "cell type" category should be 5 bars representing the "age" categories. The y-axis would represent the gene expression values (mean + error bars). </p>
  
  <p>My code:</p>
  
  <pre><code>mat= t(exprs(eSet))
  colnames(mat) = fData(eSet)$Symbol
  rownames(mat = pData(eSet)$genotype
  GENOTYPE &lt;- rownames(mat)
  AGE &lt;- pData(eSet)$age
  d.f_all_genes2 &lt;- data.frame(GENOTYPE, AGE, mat)
  
  d.f_all_genes2[1:3,1:10]
  
  GENOTYPE AGE X1.2.SBSRNA4 A1BG A1BG.AS1 A1CF A2LD1 A2M A2ML1 A2MP1
  1 rag_a   54            0    0        0    0     0   0     0     0
  2 rag_wt  54            0    0        0    0     0  18     0     0
  3 wt_wt   54            0    0        0    0     0   1     0     0
  
  melted &lt;- melt(d.f_all_genes2, id.vars="GENOTYPE") 
  head(melted)
  
             GENOTYPE   variable value
  1           rag_a       AGE     54
  2           rag_wt      AGE     54
  3           wt_wt       AGE     54
  </code></pre>
  
  <p>Unfortunately, I lost all the genes.</p>
  
  <p>I was also planning to do the followings:</p>
  
  <pre><code>means &lt;- ddply(melted, c("AGE", "variable"), summarise, mean=mean(value))
  means.sem &lt;- ddply(melted, c("AGE", "variable"), summarise, mean=mean (value),sem=sd(value)/sqrt(length(value)))
  means.sem &lt;- transform(means.sem, lower=mean-sem, upper=mean+sem)
  
  ggplot(means[means$variable == "GENE of Interest=Symbol",], aes(x = factor(AGE), y = mean))  + geom_bar(stat= "identity", colour = "blue", outlier.shape = NA)+ facet_grid(~GENOTYPE) + facet_wrap(~variable) +  ylab(expression(paste(Log[2], " Expression Values"))) + theme(axis.text=element_text(size=13, color="black"),axis.title=element_text(size=12, face="bold",color="black"), plot.title=element_text(size=14,face="bold", color="black"), strip.text.x = element_text(colour = "black", face= "bold",angle = 0, size = 20)) 
  </code></pre>
  
  <p>Any advice and help how to make it work are highly appreciated. </p>
  
  <p>Thanks a lot in advance.</p>