I am pretty new to ggplot2 and I would like to draw a histogram of the number of articles published per year (or 5 years) for a systematic review. I have a df like that:
Df <- data.frame( name = c("article1", "article2", "article3", "article4"),
date = c(2004, 2009, 1999, 2007),
question1 = c(1,0,1,0),
question2 = c(1,1,1,1),
question3 = c(1,1,1,1),
question4 = c(0,0,0,0),
question5 = c(1,0,1,0), stringsAsFactors = FALSE )
ggplot(Df, aes (date))+
geom_histogram(binwidth = 5, color= "black")
Plus, for each bar of the histogram, I would like to fill the bars with the number of articles that covered a particular type of question (question 1 to 5, coded 1 or 0 depending on if the question is present or absent).The thing is I have 5 questions I would like to make visible in one diagram. And I don't know how to do that... I tried the fill argument and to do it with a geom_bar but failed.
Thanks so much in advance for your help