Steps for Completion:
- Merge the USStates data with states_map.
- Before merging, change the states variable in USStates to the same format used in states_map.
- Use the ggplot options geom_polygon and coord_map to create the map.
- For aesthetics, run the following code and specify x=long, y=lat, group=group, and fill=ObamaVote.
Outcome:
The complete code is shown as follows:
USStates$Statelower <- as.character(tolower(USStates$State))glimpse(USStates)us_data <- merge(USStates,states_map,by.x="Statelower",by.y="region")head(us_data)