Question: For instance, in 2 0 0 8 , typically red states - including North Carolina, Indiana, and Virginia - helped elect Barack Obama to the
For instance, in typically red statesincluding North Carolina, Indiana, and Virginiahelped elect Barack Obama to the presidency.
In this exercise, we will again map the US presidential election results for states.
However, our data will be more detailed in two respects. First, we will analyze data from presidential elections from to allowing us to visualize how the geography of party choice has changed over time. Second, we will examine election results at the county level, allowing us to explore the spatial distribution of Democratic and Republican voters within states. The data file is available in CSV format as elections.cv Each row of the data set represents the distribution of votes in that year's presidential election from each county in the United States. Table presents the names and descriptions of variables in this data set.
We begin by visualizing the outcome of the US presidential election at the county level. Begin with Massachusetts and Arizona and visualize the countylevel outcome by coloring counties based on the twoparty vote share as done in section The color should range from pure blue Democratic to pure red Republican using the RGB color scheme. Use the county database in the maps package. The regions argument of the map function enables us to specify the state and county. The argument accepts a character vector, each entry of which has the syntax state, county. Provide a brief comment.
Next, using a loop, visualize the countylevel election results across
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
