We will start with simple graphs and build our way up towards advanced graphs. The first graph we will create is a bar graph. We will plot a frequency table that shows how many sale orders we have for each QUANTITY number in our sales. To do so, we use the ggplot() function using sales as the data and setting up the aesthetics with the aes() function with QUANTITY in the x axis (the first argument).
After we create a graph base with the ggplot() function, we add layers for different objects we want to see in the graph (for example, bars, lines, and points). In this case, we add bars with the geom_bar() function. Note how this layer is added using the + (plus) sign to the graph base. After that, we add another layer for the title with ggtitle(). Finally, we add an x axis specification with the scale_x_continuous() function that will...