Homework 3

Acquire and familiarize yourself with the data

A. Identify two surveys that you want to compare. This part involves skimming the codebooks and questionnaires.

  • Same question in two waves
  • Same question in similar waves of different surveys
  • Slightly different question in two surveys
  • Different question wording across two surveys

Survey sources:

  • Annenberg
  • Roper ipoll
  • World Values Survey
  • European Values Study
  • Eurobarometer
  • Afrobarometer
  • Latinobarometer
  • Asiabarometer
  • ANES
  • BES
  • CCES

B. Sketch and/or describe the graph(s) that you intend to make; these amount to informal research hypotheses.

C. Write down the target shape of the data (a complete typical row of a melted or denormalized data frame for plotting. This is also before you write anything inside a code chunk! What do you eventually need to fulfill your graph's data contract? e.g., {country: "", value: "", survey: "", year: ""}

Write code to analyze and visualize it

D. Write a script that reads, transforms, prepares data for your graph.

E. Make it actually make your graph. (Or something. If your sketch is out of reach right now, put something else on the page. Note also we will be discussing some map plotting soon.)

F. Write expressive fantasy function calls that describe how you read, transformed, and prepared the data for the graph. You can initially put these in a eval=FALSE code chunk:

survey1 <- loadSurvey(1)
survey1 <- selectVariables(survey1, ...)
survey1 <- handleMissingData(survey1, ...)
survey1 <- labelValues(survey1)
aggregate1 <- summarizeQuestions(survey1, ...) # aggregation of some kind
plotData <- preparePlotData(aggregate1, ...)

survey2 <- loadSurvey(2)
plotData <- rbind(plotData, plotData2) # (maybe)
ggplot(, aes(...)) + ...

In other words, read your code and encapsulate blocks of it to make them more abstract.

G. (Bonus) Write (some or all of) the functions to read, transform, and analyze the data.

Published: October 09 2014

  • category:
  • tags: