# Regional summary
Coding Assignment 2
Overview
For this assignment, you are going to download some variables using the wbstats
and vdemlite
packages. Then you are going to wrangle these data and merge the two data sets into one and analyze how they relate to women’s representation in national parliaments. Do your work for each step in the code chunks provided.
Here is a setup code chunk. You can load all of your packages here or as you go along in the code chunks below using the library()
function. However, note that you really only need to load a library once per document.
Please refrain from installing any packages in your code chunks because this will also install them every time the code chunk is run or your document is rendered. This may not be desirable for you or whoever is looking at or running your code (e.g. me).
Step 1: Download data from V-Dem (20pts)
Use the V-Dem codebook or the searchdem()
function in vdemlite
to identify one measure of democracy and one indicator related to women’s empowerment (or two measures of women’s empowerment). Now use fetchdem()
to download the most recent 25 years or so of data for your analysis for all countries in the dataset. Make sure to load the packages that you need and glimpse()
the data or View()
it to make sure that it downloaded properly.
Step 2: Download data from the World Bank (20 pts)
Next, download the variable on women’s represenation that we used in Module 1.2 (“SG.GEN.PARL.ZS”) and at least one additional measure related to women’s empowerment. Go to the WDI site the wb_search() function to identify relevant variables. Download data for the same time period as you did for the V-Dem data for all countries.
Try to make sure you download indicators with enough data to conduct your analysis. You won’t get great results if there are too many NAs.
Step 3: Merge the data (20 pts)
Now add country codes using the countrycode
package and merge the data using left_join()
.
Step 4: Summarize your combined data set (20 pts)
Use group_by()
, summarize()
and arrange()
to glean insights about your data. For example, how do regions compare on mean values of women’s representation and how do these values relate to the values of other variables in your data set? Which countries stand out in terms of women’s representation?
# Country summary
Step 5: Interpret your data (10 pts)
Write a paragraph or so relating your insights to the Norris reading about electoral reform and women’s representation. Picking a handful of country cases from your data, how does your summary of gender and democracy variables relate to the level of female representation in a country? How would you relate these findings to Norris’s argument about the importance of an inclusive democracy?
Don’t write your paragraphs or any interpretation or analysis in a code chunk. Use markdown text. Quarto is designed to be a literate programming tool, so you can write your analysis in markdown text and include code chunks when necessary to support your argument.
Step 6: Pivot WB Data (10 pts.)
Sometimes our data does not come in the format that we need to have it in for our analysis. Demonstrate that you know how to pivot data from wide to long form using the world_bank_pop
data frame that comes with the tidyr
package. Then pivot again (wider this time) to get the data into tidy format.
Extra Credit (3 pts.)
Following the example that we did in class, download some messy data from the World Development Indicators website and wrangle it so that it is a tidy data frame. Be sure to download more than one data variable and don’t forget to use backticks (``) when dealing with unconventional variable names.
Now render the document to make sure everything runs and to produce a final HTML document!
Submission
After rendering your document, export your project folder and submit it on Blackboard. You will find the link to the Coding Assignment one submission portal under the Assignments link. There is a screen capture video in the Discord server that will help you understand how to do this.