In this recipe, we will learn how to make bar plots that are useful to visualize summary data across various categories, such as sales of products or results of elections.
First, we need to load the
citysales.csv example data file (you can download this file from the code download section of the book's companion website):
Just like the
plot() function we used to make scatter plots and line graphs in the earlier recipes, the
dotchart() functions are part of the base graphics library in R. This means that we don't need to install any additional packages or libraries to use these functions.
We can make bar plots using the
barplot() function as ...