In this section, we'll create a two-dimensional bar chart for the total sales of a company in different months.
Let's begin by following these steps:
- Load the data. Add the line require (Lock5Data) into your code. You should have installed this package previously.
- Review the data with the glimpse(RetailSales) command.
- Plot a graph of Sales versus Month.
- Use ggplot + geom_bar(..) to plot this data, as follows:
ggplot(RetailSales,aes(x=Month,y=Sales)) + geom_bar(stat="identity")
A screenshot of the expected outcome is as follows: