I am rather new in R and ggplot. And I am not sure if what I want is doable.
Here is (a portion of) my data:
> mdf
Batch A B C
Yes it's possible, you just need to reshape your data first, then you can use position = "dodge"
to draw a bar for each key
. With tidyr
:
library(tidyr)
library(dplyr)
library(ggplot2)
mdf %>% gather(key, value, -Batch) %>%
ggplot(.,(aes(Batch, as.numeric(value), fill = key))) +
stat_summary(fun.y = sum, geom = "bar", position = "dodge")