Getting intuition with graphs and correlations
Now that we have some clean data to work with, we will create lots of plots to build intuition about the data. In this chapter, we will work with plots that are easy to create and are used for exploratory purposes. In Chapter 4, Simulating Sales Data and Working with Databases, we will look into publication ready plots that are a little more verbose to create.
Visualizing variable distributions
Our first plot is a simple one and shows the proportion of votes by each RegionName
. As you can see in the plot shown below, the London, North West, and West Midlands regions account for around 55 percent of the observations in the data.

Vote Proportion by Region
To create the plot, we need to create a table for the frequencies of each region in RegionName
with the table()
function, then we feed that to the prop.table()
function, which computes the corresponding proportions, which in turn are used as heights for each bar.
We use the barplot()
function to produce...