Below you again load the obama_vs_mccain
dataset:
State Region Obama McCain Turnout Unemployment Income Population ...
1 Alabama IV 38.74 60.32 61.6 5.9 22732 4802982
2 Alaska X 37.89 59.42 68.0 6.6 29382 721523
3 Arizona IX 44.91 53.39 55.7 7.1 25203 6412700
4 Arkansas VI 38.86 58.72 53.1 5.8 20977 2926229
5 California IX 60.94 36.91 62.0 8.2 29020 37341989
6 Colorado VIII 53.66 44.71 70.8 5.4 29679 5044930
7 Connecticut I 60.59 38.22 NA 6.2 36468 3581628
8 District of Columbia III 92.46 6.53 62.0 7.4 40846 601723
9 Delaware III 61.91 36.93 66.7 5.9 28935 900877
10 Florida IV 50.91 48.10 67.4 7.3 26503 18900773
...
Draw a scatterplot of the percentage of unemployed people in each state (on the horizontal axis) and the percentage of people who voted for Obama (on the vertical axis):
ggplot2
(store the graph in an object called UO
)
(from: Cotton, 2013, Learning R, O’Reilly)