I'm a complete R noob and am a bit stumped on one of my homework problems. Below is the type of histogram I am trying to create using ggplot2:
!(https://i.stack.imgur.com/8CtcZ.jpg)
I have a dataset which specifies the release period, average rating, and the rating year of a list of movies.
My dataset includes a column called rating.year, where every sample of data is categorized into either "2004" or "2005", and another column called "Release.period", which is used to label the X axis. The Y axis is the mean of all ratings of movies released in 2004, and 2005 . I need to create a histogram that looks identical to the one shown, where the red bar represents the average rating of all movies rated in 2004, and in blue the average of all movies rated in 2005.
So my question is: Using ggplot2, how do I calculate the mean of the ratings for the respective years and plot it onto a histogram, and how do I create two separate bars as shown in the model histogram?