You are on page 1of 2

INAF-252

Assignment #1
Professors Nita Rudra & Joel Simmons
TA: Olivia Nesbit
Due: Oct 2, 3:00pm

I. Introduction:
In this assignment, you are asked to demonstrate your understanding of the
ggplot2 graphics package in R. On our course Canvas cite (following the links
for Files > Data), I have uploaded the following 4 files.

1. Data_WVS_CrossSection.csv: A data set containing country averages for 57


countries for various questions on the Wave 6 of the World Values Survey. Ive
included only a subset of the questions from the survey. Use the World Values
Survey codebook you skimmed earlier this term to translate the variables names
into the actual questions asked.
2. Data_WVS_Individual.csv: A data set containing responses to a subset of the
question on the Wave 6 of the World Values Survey from about 86,000
individuals covering 57 countries. Ive included only a subset of the questions
from the survey. Use the World Values Survey codebook you skimmed earlier
this term to translate the variables names into the actual questions asked.
3. Data_WDI6014.csv: This is the data that weve used before in this class. It
includes data for over 150 countries with data for the years 1960 2014 when
that time frame is available. The variables included are:
a. country the countrys name
b. year year of the observation
c. wdi_gdpcap per capita GDP
d. wdi_gdpcap_grow the growth rate of per capita GDP
e. wdi_aid the dollar amount of foreign aid going to the country
f. wdi_hdi the countrys human development index
g. life_exp average life expectancy in the country
h. inf_mort infant mortality per 1000 lives births in the country
i. school_exp expected school years attended in the country
j. fertility fertility rate
k. poverty_share share of the country living under $2 per day
l. literacy literacy rate
m. pop population
n. region the countrys region
4. CountryAssignments: A file that randomly assigns each student in this class to one
particular country to examine in some of the graphs below.

II. The assignment


You are assigned to make three separate graphs, each graph uses one of the 3
data sets discussed above.

1. First, you are to make a scatter plot using any two numeric variables in the
Data_WVS_CrossSection data set. Besides the points themselves, the scatter
plot must contain the following information:
a. A regression line through the points that shows the general correlation
between the variables.
b. Country labels for each point that is plotted.
c. Use an aesthetic to denote to which region of the world the countries
belong.
d. Well-named X and Y-axes.
e. In the comments of your script file (about which more below), briefly
note what the general relationship between the two variables is and
whether you see any countries that seem like outliers from the general
trend.

2. For the second graph, each of you has been assigned a particular country. See
the (CountryAssignments file to see which country you should study.) Using the
Data_WVS_Individual data set, plot a histogram that shows how the survey
respondents for your assigned country answered any one of attitudes question.
Included in the data. While doing this, use an aesthetic to illustrate whether
there are any differences between how men and women responded to the
question.

3. For the third and final graph, use the Data_WDI6014 data set that we have
worked with before to plot the evolution of per capita GDP for your assigned
country. (NOTE: Some countries may not have data for certain variables
variables like foreign aid and literacy are often missing for example. To be
safe, plot something like per capita GDP or the GDP growth rate.)

III. Submitting the assignment


All assignments will be submitted electronically to Canvas. The due date is
Monday October 2 by 3:00 p.m. To submit the assignment you will upload an
R script file that shows the code you used to make the various graphs. This file
should use comments to indicate which graph is which. Moreover, all plots should be assigned
to an object. Most importantly, your professors and TA should be able to run your
script file to quickly create each of the three graphs discussed above. When
making your script file, please follow some simple naming conventions:
1. Name your entire script file using the following format:
Lastname_Assignment1
2. Name the objects in your script file using the following format:
Lastname_plotnumber

You might also like