Work Hours
Everyday: 北京时间8:00 - 23:59
Module 4 Assignment
PLS 202: Introduction to Data Analytics
Download and open the assignment4.Rdata file from D2L. It a dataset called elect with four variables:
country, year, rad_right which gives the percent of vote in the country’s election that went to radical
right parties, and growth, which gives the GDP growth rate for the year. Feel free to use slides, readings,
or the internet to help with the assignment.
Each question is worth 2 points except Q3.1, which is worth 3 points. Please be sure to submit your homework
in PDF format, including all your code and output. Failure to do so will result in a 10% deduction of the
total grades.
Question 1
- Use ggplot to graph the electoral success of radical-right parties in Germany. First create an object of
only German observations, then graph it with a lineplot. Some notes:
• Give the axes appropriate titles, and give the overall graph a title
• Pick whichever theme you would like for this graph, other than the default (you can see the
available themes on the ggplot cheat-sheet I showed you, https://ggplot2.tidyverse.org/reference/
ggtheme.html)
• Remove the border and axis ticks - Next, do the same for Germany’s GDP growth.
Question 2 - Now lets compare radical right voteshare in Germany and Sweden. Create a new object called ge_sw
that is only the observations from these two countries. - Use ggplot to graph them together. Some notes:
• Use either color or linetype to differentiate the countries.
• Remove the title from the legend.
• Move the legend to the top or bottom of the graph.
• Give the axes appropriate titles, and give the overall graph a title
• Pick whichever theme you would like for this graph, other than the default
• Remove the panel border and axis ticks - Provide a very brief (2-3 sentences) interpretation of these results. What are some findings from the
plot?
1
Question 3 - Finally, plot radical-right voteshare and gdp growth in Sweden on the same graph. It should present
both points and lines in one plot. Plot radical-right success in red, and gdp growth in black.
1) Use the black and white theme, 2) remove the panel border and axis-ticks, and 3) give everything
appropriate titles. [Hint: first, you might need to create a subset of data containing observations of
only Sweden.] - Provide a very brief interpretation between gdp growth and radical-right success in Sweden. Can you
spot any relations between the two variable?
2