I have difficulties producing a barplot in ggplot2. I have followed the instructions but I am not so sure in programming yet.
library(ggplot2)
## Load my data
d <- structure(list(author = structure(c(1L, 2L, 4L, 3L, 5L, 6L), .Label = c("Bahr et al", "Fuller et al", "Garbossa et al", "Gokhale et al", "Iuchi et al", "Lee et al"), class = "factor"), nAE = c(22L, 34L, 158L, 90L, 70L, 41L), AE = c(3L, 1L, 7L, 1L, 3L, 10L), SAE = c(0L, 1L, 0L, 0L, 0L, 0L)), .Names = c("author", "nAE", "AE", "SAE"), class = "data.frame", row.names = c(NA, -6L))
## This is as far as I get
ggplot(data=d, aes(x=nAE, y=author, fill=AE))
I want my plot to look like this:
My data consists of
head(d)
author nAE AE SAE
1 Bahr et al 22 3 0
2 Fuller et al 34 1 1
3 Gokhale et al 158 7 0
4 Garbossa et al 90 1 0
5 Iuchi et al 70 3 0
6 Lee et al 41 10 0
This is six studies on side effects of drug A. d$nAE is the number of people not having side effects, d$AE represents patients having adverse effects whereas d$sAE represents patients having severe side effects.
I want my plot to illustrate these three values per study. To compare to the attached ggplot, the red color would visualize d$nAE, the green color d$AE and the blue color d$sAE.
Thanks in advance, C.